Thousands of mourners packed a cathedral to hear Canada's Prime Minister call Corporal Nathan Cirillo, the soldier shot dead outside the parliament in Ottowa, an inspiration.

The 24-year-old soldier's coffin, draped in the country's Maple Leaf flag and accompanied by members of his Argyll and Sutherland Highlanders of Canada regiment in kilts, was taken to his funeral yesterday in a procession through his home city of Hamilton, Ontario.

Stephen Harper told mourners at Christ's Church Cathedral that his actions in confronting the gunman who killed him had inspired and united his countrymen and women.

Addressing Corporal Cirillo's five year-old son in the congregation, Mr Harper choked back tears. He said: "May time ease the searing pain of today. And may his son, young Marcus Daniel Cirillo, some day find comfort in the fact that our entire country looks up to his dad with pride, with gratitude, with deep abiding respect. We are better for his life and we are diminished by his loss."

Major the Reverend Canon Rob Fead called Corporal Cirillo "Canada's son", and said the tragedy had helped bring the country together.

He said: "We gather this day in faith and in hope. His bravery, his sacrifice, is not in vain."

Corporal Cirillo, 24, was one of two soldiers killed in a pair of attacks last week that police said were carried out independently by radical recent converts to Islam.

The killings took place as the country's military stepped up its involvement in airstrikes against Islamic State militants in Iraq.

It has shocked Canada and prompted a debate on how its open culture, and particularly the low-key security in the capital Ottawa, may need to change. Security services have warned that citizens who adopt extremist views and take up arms against the state pose a "serious" threat.

Corporal Cirillo was on ceremonial watch at the nation's war memorial in Ottawa on October 22 when he was shot dead by Muslim convert Michael Zehaf-Bibeau. The gunman then stormed the parliament building where Mr Harper was addressing a caucus of Conservatives. Zehaf-Bibeau, a drug addict, was shot dead by sergeant-at-arms Kevin Vickers, 56.

Corporal Cirillo's was the first of the soldiers' funerals. The other victim, Warrant Officer Patrice Vincent, 53, died when he was run over by an Islamist extremist who was later fatally shot. WO Vincent is to be laid to rest in Quebec on Saturday.

Wearing a red poppy at yesterday's funeral, office worker Nadia Grandoni, 35, said: "I was born here and even though I didn't know Nathan, I feel like he was my brother. He has done us proud. We love him, as a community and as a country. Both him and Patrice Vincent. Canada loves them both."

Corporal Cirillo was buried in a military cemetery in the city.