The search for Justin Bourque, who is believed to have carried out Wednesday's attack, had forced authorities to put Moncton on lockdown as police hunted the man described as armed and dangerous.
The massive manhunt ended when the 24-year-old Bourque finally surrendered, reportedly telling police, "I'm done." Charges were to be filed later in the day.
The shooting was the worst tragedy to hit the Royal Canadian Mounted Police since 2005, when four of its agents were killed in Alberta in the west.
The shooting sent shockwaves rippling across Canada, which prides itself on being largely free of the gun violence that regularly plagues cities in the neighboring United States.
"Justin Bourque was arrested by RCMP at 12:10 in Moncton. He is in police custody. Residents of north Moncton can now leave their homes," the RCMP said on Twitter.
Residents of Moncton, a city of 70,000 in New Brunswick province, had been forced to remain behind locked doors while police combed a wooded neighborhood with dogs, armored vehicles and aircraft for about 30 hours.
Moncton had become a ghost town as shops, schools and government buildings remained closed on Thursday. Some people even left the city altogether.
In the end, Bourque surrendered to special operations police without a fight, said Michelle Thibodeau, who witnessed the arrest, which took place in her backyard.
"Justin came out with his hands up, and he said, 'I'm done,'" she told public broadcaster CBC.
Bourque was still dressed in the same military fatigues that he wore when he allegedly shot the three officers on Wednesday, and was dripping wet.
RCMP Superintendent Marlene Snowman told a press conference that Bourque was not carrying any weapons at the time of his arrest but that firearms had been recovered nearby.
On Wednesday, witnesses said he was armed with a hunting rifle and an automatic rifle when he opened fire on police officers on a Moncton street.
Condolences poured in from across Canada and from police forces in the United States and Europe.
RCMP Commissioner Bob Paulson praised his officers, saying: "Great work, folks. The results speak for themselves. You have restored order to your community."
Of the victims, he said: "Their deaths are beyond comprehension. Their ultimate sacrifices will never be forgotten."
The fallen officers were identified as Constable David Ross, 32; Constable Douglas Larche, 40; and Constable Fabrice Gevaudan, 45, who had joined the RCMP after immigrating to Canada from France.
Constables Darlene Goguen and Eric Dubois were recovering from their injuries sustained in the shooting, officials said.
On what appeared to be his Facebook page, Bourque - who lived in a local mobile home trailer park where residents expressed horror over the attack - posted extracts from a song by American heavy metal band Megadeth just before the shooting.
He took letters from the refrain of the song and spelled out the letters of the word freedom accompanied by the words: "this spells out FREEDOM, it means nothing to me."
He also wrote about his love of guns and loathing of law enforcement officials, who said he had no previous run-ins with the law.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ