TWO of the four people killed in a shooting in the Canadian city of Fredericton, New Brunswick, are police officers.

Fredericton police said one suspect was in custody after the shooting, which took place in an apartment complex.

David MacCoubrey, who lives in Fredericton, said he heard about 20 gunshots and hid on the 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 awoke in his apartment on Brookside Drive at around 7am to the sound of three gunshots 10 metres from his bed.

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

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.

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 north-east of Maine.

New Brunswick Premier Brian Gallant tweeted his condolences.

He said: “During this difficult time, our thoughts are also with the courageous women and men on the front lines working to keep us safe.”