An armed member of Canada's military faces 22 charges after breaching the gates of an estate where Prime Minister Justin Trudeau lives.
Police say Corey Hurren, 46, drove a pick-up truck through the main entrance of Rideau Hall in Ottawa on Thursday morning.
He then allegedly entered the grounds on foot before being confronted by police.
Police spoke to him for almost two hours before arresting him.
Mr Hurren drove from his home in Manitoba to Ottawa, some 2,000 km (1,240 miles) away, police say.
His charges include uttering threats, "possession of a weapon for dangerous purpose" and contravening rules on the transportation of firearms.
The Royal Canadian Mounted Police (RCMP) said in a Friday news conference they believe he acted alone and that he was a member of the Canadian Armed Forces.
CBC reported he is a Canadian Ranger, a branch of the armed forces that patrols rural and coastal regions.
Mr Trudeau and his family, who are currently living at a cottage on the Rideau Hall estate while the prime minister's official residence is being renovated, were not at home at the time of the incident.
Nor was Governor General Julie Payette, who resides at Rideau Hall as the official representative of Queen Elizabeth II, Canada's head of state.
During a press briefing on Friday, Mr Trudeau thanked "the extraordinary police services of the RCMP".
The RCMP said it is working closely with the Canadian Armed Forces to investigate the incident, which was resolved "quickly and safely".
"Through our members' vigilance, quick action and successful de-escalation techniques, this highly volatile incident was resolved swiftly and peacefully," the RCMP's deputy commissioner, Mike Duheme, said.
The grounds of Rideau Hall, which sits on an 88-acre (0.35 sq km) wooded estate, have been closed to the public during the coronavirus pandemic.
Police allege that at approximately 6:30 local time (10:30 GMT) Mr Hurren drove his pick-up truck carrying several weapons through the gates at Rideau Hall.
Pictures taken outside Rideau Hall appear to show damage to its main pedestrian gate, which the suspect rammed through in his vehicle.
The vehicle was disabled on impact, so the suspect got out and began to walk the grounds on foot, carrying a rifle, police said.
The suspect was quickly spotted by grounds staff and RCMP members, who put the area in lockdown.
RCMP officers approached the suspect at about 06:45 local time, and began to talk to him. He was arrested at 8:30 local time.
The RCMP would not discuss the nature of the conversation, as the investigation is ongoing.
Pictures from Thursday show an empty black pick-up truck inside the grounds of the estate. The RCMP said an army unit with a bomb-disposal robot searched the vehicle as a precaution.
Police confirmed the suspect had multiple weapons, though did not confirm the number or type.
Mr Trudeau has moved to limit the ownership of certain weapons in Canada, where gun ownership is popular, especially in rural parts of the country.
He introduced a long-promised ban on assault-style weapons in May this year, after a gun a rampage across the province of Nova Scotia that became the deadliest shooting in Canada's history.