Two police officers were among the four people shot and killed on Friday morning in the Canadian city of Fredericton, New Brunswick, police said.
Fredericton Police tweeted "a suspect" was in custody, however, it was not clear whether the authorities were looking for other suspects.
"No name [of the victims] is released at this time, please appreciate that this is a difficult time for their families and colleagues, we will provide more information when we can," the authorities wrote on Twitter.
The previous Friday morning officials tweeted to warn residents to avoid Brookside Drive due to an "ongoing accident". Later, the police confirmed that four people were killed in the accident.
Police have urged residents to stay in their homes and lock their doors. The first rescuers were on the scene.
Residents told CBC News that gunshots sounded like noises.
"In time, it could have been a gunshot, it was a kind of pop, pop, pop, pop," resident Robert Didiodato told CBC News.
Didactic said that the people were in their homes and followed the instructions of the department.
CTV News spoke with a woman who was escorted from her residence in the area and told the station she had heard what appeared to be a shot. The press agency reported that the police were talking to residents of the area asking what they heard / witnessed Friday morning.
David MacCoubrey, who lives in Fredericton, said he heard about 20 shots and hid on the floor of his kitchen.
"I'm at my floor," he told the Associated Press in a telephone interview. "The policemen came through my place, they searched all the apartments in the building, it seemed to have started in the courtyard."
MacCoubrey said that the police inspected the buildings and sat away from the windows.
Travis Hrubeniuk said his girlfriend had just left for work around 7:45 am when she began to hear a steady stream of sirens.
Hrubeniuk said that the residents were advised to stay inside with the doors closed. The quiet residential neighborhood, which has houses, grocery stores, a church and a primary school, is the last place Hrubeniuk expected to encounter a dangerous situation.
"This is the first time I have heard of any serious crime or violent crime in this city," he said.
Fredericton has a population of about 58,000 and is located just north-east of Maine. The city is the capital of New Brunswick.
The Associated Press contributed to this report.