Canadian police said they had arrested the 24-year-old man who they suspect shot dead three police officers and wounded two more in the eastern city of Moncton, ending a massive manhunt.
The shooting was one of the worst of its kind in Canada, where gun laws are stricter than in the United States and fatal attacks on police are rare.
"Justin Bourque 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 in a tweet on Friday, the Reuters news agency reported.
Borque was the target of a massive search operation, which started after the shootings on Wednesday evening.
The suspect was spotted three times on Thursday but still managed to elude the manhunt that all but shut down the city of about 70,000 people about 1,177km east of the Canadian capital, Ottawa.
The deaths spurred an outpouring of grief across Canada.
The last major killing of police took place in Mayerthorpe in the western province of Alberta in 2005, when a gunman shot four officers before turning the gun on himself.
Those killings were the most the RCMP had suffered in a single day in 100 years.