Former Liberal interim leader Bob Rae has apologized for a gesture he made at the party's weekend convention as he poked fun at the prime minister's praise for Conservative predecessor Stephen Harper.

The incident, which saw Rae put two fingers in his mouth in a gagging fashion, occurred on Saturday as Rae was listening to Prime Minister Justin Trudeau's speech in Winnipeg.

And this is former Liberal leader <a href="https://twitter.com/BobRae48">@BobRae48</a>'s reaction to PM Trudeau's tribute to former PM Stephen Harper <a href="https://twitter.com/hashtag/cdnpoli?src=hash">#cdnpoli</a> <a href="https://t.co/BsoPcNEdCh">pic.twitter.com/BsoPcNEdCh</a> —@chintapuxley

As Rae pretended to gag, he was caught on video taken by a Canadian Press reporter. The video quickly went viral and made the rounds at the Liberal national convention.

Rae took to Twitter on Saturday night to apologize, saying the joke was in poor taste.

I apologise for that thoughtless gesture during PM's tribute to Mr Harper - a joke in poor taste that I regret very much. <a href="https://twitter.com/hashtag/notmeatmybest?src=hash">#notmeatmybest</a> —@BobRae48

Prime Minister Justin Trudeau spoke almost glowingly of the Conservatives and Harper at the Winnipeg convention, the first such gathering since the Liberals defeated Harper's Conservatives in last fall's election.

After taking a few pokes at the Tories, who were simultaneously holding their own convention in Vancouver, Trudeau turned serious.

"We need to remember that even though they may be our opponents, they're not our enemies. They're our neighbours and our friends," he said.

Liberal Prime Minister Justin Trudeau praised his Conservative predecessor, saying 'there can be no doubting Stephen Harper's commitment to our country.' (CBC)

"So, I want to take a moment. You see, there are only a handful of people alive who know what it's like to do this job ... And I can tell you, even if you weren't a fan of his politics, there can be no doubting Stephen Harper's commitment to our country."

Trudeau asked Liberals to join him in thanking Harper, who has let it be known he will retire from politics over the summer, for "his many years of public service."

Trudeau, the eldest son of former prime minister Pierre Trudeau, said he's among the few who know first-hand that it's not easy to be part of a prime minister's family. So he also thanked Harper's wife Laureen and his children, Ben and Rachel, for "standing with him through thick and thin."

Tories criticized as slow on marriage equality

Trudeau was not all sweetness and light when it came to the Conservatives, however.

He also noted that the Tories had been debating at their convention whether to delete the party's policy on marriage being the union between one man and one woman.

"Among other things, they're debating the merits of marriage equality. In 2016. More than a decade after we made same-sex marriage legal in Canada," Trudeau said to gales of laughter.

"Well, better late than never, right? Who knows, 10 years from now they might finally be willing to admit that climate change is real. Or that tax cuts for rich people don't help the middle class,. Or that government shouldn't legislate what women are allowed to wear on their heads."

The Conservatives voted Saturday to drop the sections of its policy defining marriage as between one man and one woman.

​