MONCTON, New Brunswick — A man suspected in the shooting deaths of three Royal Canadian Mounted Police and the wounding of two others in a rare case of gun violence in eastern Canada was arrested early Friday, police said.
Paul Greene, a spokesman with the Royal Canadian Mounted Police, said Justin Bourque was arrested at about 12:30 a.m.
The 24-year-old Bourque had been wanted after the shooting Wednesday evening in the northwest area of the city.
Several hundred officers from New Brunswick and elsewhere from across Canada were involved.
Frightened residents had huddled in their homes for a second night as police scoured the eerily quiet streets in search of Bourque.
Bourque’s neighbors described a withdrawn man who collected guns and was an avid hunter of birds, deer, and moose.
Bourque, who was armed with high-powered long firearms, was spotted three times Thursday but still managed to elude the massive manhunt that all but shut down this city of 69,000 people about 180 miles east of the Maine border.
Dozens of police officers with their weapons drawn could be seen in a part of the search area, some glancing around buildings.
Others, including members of a tactical unit, were patrolling streets within the cordoned off area. Armored security trucks were also visible.
Bourque was wearing military camouflage and carrying two rifles in a picture released by police on Twitter.
At one point, he was seen going in and out of a wooded area, Commander Marlene Snowman said.
Investigators have not determined a motive for the shooting Wednesday evening, in which the officers were killed while responding to a call about an armed man at the north end of Moncton.
Police declined to identify the dead or injured officers.
It was the deadliest attack on the Royal Canadian Mounted Police since four officers were killed by a gunman on a farm in the western Canadian province of Alberta in 2005. That attack remains the deadliest on Canadian police officers in 120 years.
Snowman said Bourque was not known to police.
Schools and government offices were closed, and the city pulled its buses off the roads.
Mail delivery was suspended.
The homicides were the first this year in Moncton.
Constable Damien Theriault of the Royal Canadian Mounted Police said the city had no homicides last year.
Daniel St. Louis, a commercial photographer, said he came upon the scene around 8:30 p.m. Wednesday night and saw two blood-stained police vehicles on separate streets.
One of the vehicles, a police cruiser, was surrounded by shattered glass.
The other, an unmarked SUV with its lights on and the driver’s side door ajar, had several bullet holes through its front windshield.
‘‘I walked over and I saw two feet, facing the street, toes up,’’ said St. Louis, 51. ‘‘I realized, ‘Oh my God. There’s somebody down.’ As I got close, I realized it was an officer and this is not a good situation.’’
‘‘Our quiet little city, what is going on here?’’ he said. ‘‘How is this happening to us? It always happens to somebody else.’’
Tim Holt said he and his daughter had been locked down in their home for hours. Holt’s wife worked late Wednesday and was not allowed to join her family.
A few blocks away, Conrad Gagnon, 53, said he was playing a video game in his living room when he spotted a man through a window.
‘‘It was like he was meditating on something and talking . . . like somebody on drugs and living in his own world,’’ he said.
‘‘He was talking to himself. I saw his lips moving.’’
Shortly afterward, Gagnon said he heard gunfire.