Police in the eastern Canadian city of Fredericton, New Brunswick, has said one suspect is in custody after at least four people were killed in a shooting.

Fredericton police are asking residents to avoid the area and stay in their homes, but the circumstances of the shooting are unclear.

Police were also asking people on Facebook not to use social media to report on police locations.

David MacCoubrey, who lives in Fredericton, said he heard about 20 shots and was hiding on his kitchen floor.

“I’m on my floor,” he said in a phone interview. “The cops have come through my place. They have searched all the apartments in the building. It sounded like it started in the courtyard area.”

He woke up in his apartment on Brookside Drive at around 7am local time to the sound of three gunshots around 10 metres from his bed.

Mr MacCoubrey said his apartment complex has four buildings in a square, and it sounded like the shots were coming from the middle of the complex.

He said police have been searching the buildings, and he has been sitting away from windows.

“It’s not something that happens here regularly,” he said.

Travis Hrubeniuk said his fiancee had just left for work at around 7.45am when he began hearing a steady stream of sirens.

Mr Hrubeniuk said residents have been advised to stay inside with their doors locked. The quiet residential neighbourhood, which has houses, grocery stores, a church and an elementary school, is the last place Mr Hrubeniuk said he expected to encounter a dangerous situation.

“This is the first time I’ve even heard of any serious crime or violent crime in this city,” he said.

In 2014, a shooting in Moncton, New Brunswick, left three Royal Canadian Mounted Police officers dead and two wounded.

Fredericton has a population of about 58,000 and is located just northeast of Maine.