OTTAWA -- Officers who rushed to the scene of a deadly shooting in Fredericton likely saved the lives of others, Prime Minister Justin Trudeau said Friday as Canadians reeled from news of early-morning gunfire that claimed the lives of four people, including two members of the local police force.

"They were unflinching in their duty," Trudeau said in a statement of the two officers who were killed at the scene. Their sacrifice "no doubt saved lives and prevented even greater tragedy."

Federal Public Safety Minister Ralph Goodale, who held a hastily assembled news conference in Sarnia, Ont., said it was too early to say exactly what happened -- or what motives were behind the shooting.

"The facts and the details are not known," Goodale said, calling the investigation into the incident "raw."

"What we do know is that four Canadians are dead, and that is a huge tragedy for the whole country."

Earlier Friday, Trudeau -- who was scheduled to be in Toronto later in the day at an event to honour the two victims of a shooting in that city just last month -- used Twitter to lead a cascade of condolences from political quarters both inside Canada and beyond as news of the shooting sank in.

Police said one person was custody and was being treated for serious injuries. After warning residents to remain in their homes with the doors locked, by about mid-morning they were able to declare that there was no longer any public threat.

An official update on the situation was scheduled for later Friday.

Goodale said the RCMP are standing at the ready should the Fredericton police need any more additional help.

New Brunswick Premier Brian Gallant also cited the brave work of first responders in a statement of his own.

"On behalf of all New Brunswickers, I offer my condolences, thoughts and prayers to the victims and their families," Gallant tweeted. "During this difficult time, our thoughts are also with the courageous women and men on the front lines working to keep us safe."

Bill Blair, a former Toronto police chief who just last month was tapped to serve as Trudeau's minister of border security and organized crime reduction, offered comfort directly to Fredericton's police chief.

"I want to extend my heartfelt condolences to all the victims," he tweeted, "including Chief Leanne Fitch on the tragic death of two of her officers in the service of their community."

Federal Conservative Leader Andrew Scheer offered prayers for the families of the officers and everyone impacted, while NDP Leader Jagmeet Singh expressed solidarity with first responders. Alberta United Conservative Party Leader Jason Kenney also joined the online chorus, citing the perils faced daily by law enforcement officials.

"We are all shocked and saddened to learn this morning of the ongoing tragic incident in Fredericton," Kenney said, calling it a "reminder of the risks our brave men and women in uniform are willing to take every day to keep us safe."

Kelly Craft, the U.S. ambassador to Canada, said she was "shocked and troubled" to learn of the tragedy.

Gun violence has been a hot topic among politicians and the Canadian public this summer, particularly after several high-profile shootings in the city of Toronto.