Justin Bourque was arrested at around 12:30 a.m., said Paul Greene, a spokesman with the RCMP. Authorities had identified the 24-year-old Bourque as their suspect after the shootings Wednesday evening in the northwest area of the city.
The attack on the Mounties' ranks was the deadliest in nearly a decade.
Michelle Thibodeau said she saw the Moncton man arrested in the front yard of her home. Thibodeau, 21, said she heard the suspect say, "I'm done," before his arrest by officers with guns drawn.
Much of this normally quiet Canadian city of about 60,400 people had been on lockdown, with frightened residents huddled in their homes as Mounties scoured the quiet streets.
A motive for the shootings was not known. Neighbors of the suspect described a withdrawn man who collected guns and was an avid hunter of birds, deer and moose.
"He never missed a season," said Kerry Fitzpatrick, who lives half a block away from Bourque and was at home when he heard the sound of gunfire. When he later heard Bourque might be the shooter, he walked over to Bourque's trailer, found an open door and Bourque's wallet on the table.
"He lost it. The guy lost it," Fitzpatrick said.
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 the city about 180 miles (290 kilometers) east of the Maine border.
Police released a map of a large portion of the northwest section of the city, including a heavily wooded area, where they wanted people to remain indoors with their doors locked. They urged residents to turn on exterior lights to help the search. Many parts of Moncton, including much of its popular downtown area, were completely shut down, with some businesses placing signs in windows explaining they were closed because of the manhunt.
Schools and government offices were closed. The city pulled its buses off the roads and mail delivery was suspended. Police commandeered armored trucks.
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.
Nervous residents who live in the same trailer park as Bourque said he was a quiet, seemingly reclusive man who shared a small, worn trailer with a roommate.
Neighbor Holly Tingley said before the capture that residents feared that Bourque might return home.
"My kids keep asking me, 'Did they catch him? Did they catch him?' It puts me on edge every time they ask," she said.
Police used air support, tactical teams and canine units. Several hundred officers from New Brunswick and elsewhere from across Canada were involved.
Bourque was wearing military camouflage and carrying two rifles in a picture released by police on Twitter.
Police still have not released the identities of the three officers who were killed Wednesday night while responding to a call about an armed man. Two other officers, whose names also were not released, were wounded.
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.
Canada's Parliament on Thursday observed a moment of silence and the flag on Parliament Hill flew at half-staff.
Commanding Officer Roger Brown said the two wounded officers had surgery for non-life-threatening injuries Thursday and he met with their families. One was later released from hospital. Police said they were unsure when the released officer would return to the job.
"The RCMP family is hurting. As is Moncton, New Brunswick and our country," Brown said.
Fitzpatrick said he stopped by Bourque's trailer five days ago.
"He seemed fine, it was a normal conversation," Fitzpatrick told The Associated Press on Thursday by phone from his home.
Fitzpatrick said Bourque "obviously had things on his mind," based on a stretch of recent Facebook posts about guns and the police.
"It was never something that we took serious because we actually know him, as friends," he said.
The three officers were the first Canadian police killed in the line of duty since March 2013, when a police officer in northern Quebec was shot after responding to a domestic violence call. According to the Royal Canadian Mounted Police website, the last officer to die from a gunshot wound was on Nov. 5, 2007.