A gunman disguised as a police officer went on a 12-hour rampage in the Canadian province of Nova Scotia, killing at least 19 people, in the deadliest mass shooting in the country's history.

Officials said the suspect, identified as 51-year-old Gabriel Wortman, was among the dead in the weekend attack. A policewoman was also killed.

Police did not provide a motive for the killings.

Canadian prime minister Justin Trudeau told a news conference: "How could this happen? We may never know why."

He added: "But we do know this. No one man's action can build a wall between us and a better day - no matter how evil, how thoughtless or how destructive."

Police began advising residents overnight on Saturday in the rural town of Portapique - about 60 miles north of Halifax - to lock their doors and stay in their basements.

Authorities said several bodies were later found inside and outside one home on Portapique Beach Road - the street where the suspect lived.

Bodies were also found at several other locations within about a 30-mile area from the neighbourhood where the shootings began late on Saturday, .

Authorities believe the shooter may have targeted his first victims but then began attacking randomly. Several homes in the area were set on fire.

Staff from the medical examiner’s office remove a body in the wake of the attack. Credit: Andrew Vaughan/The Canadian Press via AP

At least four white forensic vans were seen on Monday morning entering the neighbourhood where the shootings began.

Officials said the suspected gunman wore a police uniform at one point and made his car look like a Royal Canadian Mounted Police cruiser.

Mounted Police Chief Superintendent Chris Leather said the shooting was unlikely to be a random attack: "That fact that this individual had a uniform and a police car at his disposal certainly speaks to it not being a random act".

Mr Leather said many of the victims did not know the shooter and authorities believe he acted alone.

Constable Heidi Stevenson was killed in Canada's worst mass shooting in history. Credit: RCMP/The Canadian Press via AP

Constable Heidi Stevenson, a mother of two and a 23-year veteran of the police force, was killed in the shooting. Another officer was wounded.

Also among the dead was school teacher Lisa McCully, who worked at a local elementary school.

Nova Scotia Teachers Union president Paul Wozney said: "Our hearts are broken along with those of her colleagues and students at Debert Elementary."

Two health care workers were also among those killed, according to Von Canada, a long-term health care company, which identified them as Heather O’Brien, a licensed practical nurse, and Kristen Beaton, a continuing care assistant.

Royal Canadian Mounted Police officers were called to the petrol station. Credit: Tim Krochak/The Canadian Press/AP

The gunman, who owned a denture practice in in the city of Dartmouth, near Halifax, lived part-time in Portatipique, according to residents of the town.

Police initially said he had been arrested on Sunday at a petrol station in Enfield, outside Halifax, but later said he had died.

It was not clear how - and they did not provide further details - although one police official said that there was an exchange of gunfire between the suspect and police at one point.

Attacker 51-year-old Gabriel Wortman was among the dead in the weekend shooting. Credit: Royal Canadian Mounted Police in Nova Scotia

Corporal Lisa Croteau, a spokeswoman with the provincial force, said police received a call about "a person with firearms" late on Saturday night, which then "evolved into an active shooting investigation".

Christine Mills, a resident of the area, said it had been a frightening night for the small town, with armed officers patrolling the streets. In the morning, helicopters flew overhead searching for the suspect.

Tom Taggart, who represents the Portapique area in the Municipality of Colchester, said the quiet community had been shaken. "This is just an absolutely wonderful, peaceful quiet community and the idea that this could happen in our community is unbelievable," Mr Taggart said.

Police superintendent, Mr Leather, said authorities were investigating whether the attack had anything to do with the coronavirus pandemic but no link has been found so far.

Nova Scotia Premier Stephen McNeil called the mass shooting "one of the most senseless acts of violence in our province's history".

The attack is the deadliest shooting in Canada where such incidents are relatively rare.

The country overhauled its gun-control laws after gunman Marc Lepine killed 14 women and himself at Montreal’s Ecole Polytechnique college in 1989.

Before this weekend’s rampage, that 1989 attack had been the country’s worst mass killing.

It is illegal to possess an unregistered handgun or any kind of rapid-fire weapon in Canada.

The country also requires training, a personal risk assessment, two references, spousal notification and criminal record checks to purchase a weapon.