Royal Canadian Mounted Police officers take cover behind their vehicles in Moncton, New Brunswick, on Wednesday, June 4, 2014. / Viktor Pivovarov, AP

by Melanie Eversley, USA TODAY

by Melanie Eversley, USA TODAY

The suspect in a shooting rampage that left three police officers dead in the city of Moncton, in New Brunswick, Canada, has been arrested, the Royal Canadian Mounted Police said in a tweet early Friday morning.

Justin Bourque, 24, was placed in custody shortly after midnight, the police agency tweeted at about 12:30 a.m. The agency said residents of north Moncton would now be able to leave their homes.

The incident and ensuing chaos began Wednesday night after Bourque, wearing camouflage and carrying two rifles, opened fire, police said, leaving three dead and injuring two officers. While Bourque was at large, police shut down huge portions of Moncton, asking residents to stay indoors and leave their outdoor lights on.

One teen resident told the National Post that her family watched from their home in horror as the suspect came up behind an undercover officer and shot him dead.