A gunman suspected of killing three Canadian police officers and wounding two others in a brazen attack surrendered on Friday after a manhunt that put a province under lockdown.
The search for Justin Bourque, who is alleged to have carried out the brazen attack in the country's eastern province of New Brunswick on Wednesday, had put the city of Moncton on lockdown for more than a day as police hunted the man described as armed and dangerous.
"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 Royal Canadian Mounted Police said on Twitter.
Residents could finally emerge after having barricaded their doors while police combed a wooded neighbourhood with dogs, armored vehicles and aircraft for over 30 hours.
Moncton had become a ghost town as shops, schools and government buildings remained closed on Thursday and some people even left the city altogether.
In the end Bourque surrendered to special operations police without putting up resistance, said a witness to the arrest, Michelle Thibodeau.
The mayor of the city of 70,000 congratulated the security forces on their success.
Witnesses said Bourque, wearing military fatigues and carrying a hunting rifle and an automatic rifle, had opened fire on police officers on Wednesday on a Moncton street.
It 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.
On Thursday the flag at Parliament in Ottawa flew at half mast.
On what appeared to be his Facebook page, Bourque--who lived in a local mobile home trailer park--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.