A Canadian man accused of killing three police officers and wounding two others in Moncton, New Brunswick, has been charged with premeditated murder.
Justin Bourque, 24, appeared in court on Friday, with a heavy police presence in the building.
Officers from the Royal Canadian Mounted Police (RCMP) arrested him shortly after midnight on Friday.
The manhunt for Mr Bourque had gone into a second night after the officers were killed.
Following the arrest, police lifted a warning that residents should remain indoors and off the streets.
The three dead police officers have been identified as PC Fabrice Georges Gevaudan, PC David Joseph Ross and PC Douglas James Larche. One of the two wounded officers has been released from hospital.
They were all shot while responding to a report of an armed man at the north-west side of the town on Wednesday evening, in the deadliest attack on the country's police force since four officers were killed in the province of Alberta in 2005.
'I saw him arrested'
Mr Bourque appeared in the court in Moncton, staring ahead intently and nodding when the judge said his name.
During the short proceedings, he was charged with three counts of murder and two of attempted murder.
Neither prosecution nor defence recommended a psychological evaluation for Mr Bourque. He will next appear in court in July.
The eastern New Brunswick city of about 70,000 was slowly returning to normal on Friday. Shortly after Mr Bourque's arrest, barricades that had sealed off roads during the manhunt started coming down soon after news of the arrest leaked out, the Globe and Mail reported.
"On the one hand we feel very happy, almost elated that this person has been arrested and this ordeal is over," the mayor of Moncton, George Leblanc, told CBC.
"But at the same time we have a great sense of sadness for the losses that our families have suffered."
In a press conference on Friday, family members of PC Ross remembered him.
"My son was my hero," said his mother, Helene Rousseau, speaking in French.
"He would call us and would always tell us stories about his work," she said. "So he died doing what he loved."
A local resident named Michelle Thibodeau tweeted that she had witnessed the arrest.
"He was in my backyard. I saw him arrested in front of my eyes," she said.
"The Swat team arrived at my house and unloaded and started screaming in my backyard for him to surrender and he did. I watched it happen."
RCMP Supt Marlene Snowman told reporters Mr Bourque was unarmed as he was arrested, but there were weapons nearby.