TORONTO -- A gallery of political luminaries from all sides of the partisan divide gathered at a cavernous Toronto cathedral Wednesday to set aside their differences and pay final respects to former finance minister Jim Flaherty.

Mourners donned green scarves, a tribute to Flaherty's Irish heritage, inside St. James Cathedral as they celebrated the diminutive, combative politician, who died of a heart attack last week at the age of 64.

"What a sad time this is in the life of our country," said Prime Minister Stephen Harper, who began the proceedings with an upbeat personal tribute to his longtime political confidante.

Directly addressing Flaherty's wife Christine Elliott and the couple's triplet sons, Harper said, "We have lost a partner in politics, but you have lost a partner in life."

Harper kept his composure throughout most of what turned out to be a cheerful, light-hearted look back on the time he and Flaherty shared together in power on Parliament Hill.

"Occasionally, I imposed a final decision," Harper said of their periodic cabinet-table disputes.

"Occasionally I decided he was probably right. And occasionally, I decided he was wrong, but let him have his way because I just got so damn tired of arguing with him."

But as Harper's eulogy drew to a close, he had to compose himself as he described the day he accepted Flaherty's resignation.

"I told Jim that he had truly been over these eight years, in my judgment, the best finance minister in the world, if not indeed the best in our history," Harper said.

"I also wished him well in his next career ... and I told him not to be a stranger."

One of the most touching moments came when the prime minister addressed himself directly to Flaherty's three sons, John, Galen and Quinn.

"I lost my own father almost exactly 11 years ago, to the day," he said. "That period, I remember almost nothing of what I said or what was said to me, so powerful were the waves of emotion.

"But once that passed and perspective took hold, I came to appreciate my father's place in my life probably even more fully and deeply than if he were still here. And it is all good, and it will be all good for you."

Liberal Leader Justin Trudeau, NDP Leader Tom Mulcair and former prime ministers Brian Mulroney, Kim Campbell and John Turner were among those on hand for the funeral, as were various federal cabinet ministers, including John Baird, Peter MacKay and Chris Alexander.

Harper and his wife Laureen arrived in advance of the cortege, followed by Gov. Gen. David Johnston and his wife Sharon. Harper exchanged pleasantries with Mulroney and shook hands with Ontario Premier Kathleen Wynne as they sat down.

At one point, Mulroney and Turner, famous political rivals, were seen to exchange smiles and nods.

A host of familiar faces from the Ontario legislature -- former premier Ernie Eves and Conservative Leader Tim Hudak among them -- were also present.

Flaherty's sister Norah told the story of how their mother once discovered him throwing pennies in the trash -- a foreshadowing, perhaps, of his decision in 2012 to do away with the costly one-cent piece.

"When Mum asked Jim why he was throwing out the pennies, he said, 'They're not worth anything,"' she said. "Somewhat prophetic."

A sombre but composed Elliott was effusive in her praise of her husband.

"He was the most intelligent man I ever met, and his clarity of thought was unparalleled," she said.

"He was a proud Canadian who loved our great country, and even when his life became more difficult in the last year or so, he persevered until he was certain he would leave things in order for his successor."

Added Quinn, in a poignant message to his father: "Put your feet up, lay your head back, close your eyes and relax. We will take it from here."

Before the proceedings got underway, a choir assembled behind the altar and an organist filled the chamber with hymnal music as mourners awaited the arrival of the cortege carrying Flaherty's casket. The towering archways of the cathedral were bathed in green light.

The entire federal Conservative caucus was invited, as well as all current provincial premiers and finance ministers, as well as living former prime ministers and governors general.

Large white tents were erected on the lawn of the cathedral. Across the street from the church, a phalanx of TV cameras documented the arrival of family, friends and dignitaries.

Onlookers began gathering several hours before the ceremony was scheduled to begin. One man had his patriotism on full display, wearing a white jacket adorned with a red maple leaf and clutching a Canadian flag.

The busy downtown Toronto streets surrounding the church were closed to all vehicular traffic, except for streetcars.

The ceremonial journey of the casket began in Whitby, Ont., and proceeded along Highway 401, down the Don Valley Parkway and through downtown Toronto before its scheduled arrival at the church just before 3 p.m. ET.

Flaherty's death, which came less than a month after his retirement as minister, sent shock waves through the national capital, where flags have been flying at half-mast and the Peace Tower has been bathed in green light.

Hundreds of dignitaries and citizens lined up to pay their respects Tuesday at Whitby's Abilities Centre, which caters to the disabled and able-bodied alike. Harper arrived late in the day for a private viewing.

Labour Minister Kellie Leitch, a Flaherty confidante who rushed to his condo in an attempt to revive her friend and had dinner with him on the eve of his death, also paid her respects.

Mark Carney, the former Bank of Canada governor who now heads the Bank of England, was also on hand at the funeral, which took place under tight security just blocks from Toronto's famed financial district, a favourite Flaherty stomping ground.

Toronto Mayor Rob Ford, whose friendship with Flaherty caused the diminutive finance minister some uncomfortable moments in the media spotlight last year, was also attending. Ford and his brother, Doug, also paid their respects in Whitby on Tuesday.

Flaherty's state funeral is the first such honour since 2011, when former NDP leader Jack Layton was laid to rest. State funerals are customarily only given to current or former prime ministers, governors general, sitting cabinet ministers or members of the Royal Family.