Image copyright AFP Image caption The Obamas and Trudeaus prepare to dine at the White House official state dinner

US President Barack Obama and Canada's new Prime Minister Justin Trudeau have lavished praise on each other during the first official visit by a Canadian leader in nearly 20 years.

Mr Trudeau toasted the two nations as "siblings" at a state dinner.

Mr Obama raised his glass at the White House to the "great alliance" and joked about Mr Trudeau's previous jobs.

"If things get out of hand, remember the prime minister used to work as a bouncer," said Mr Obama.

In a joking reference to Canadian-born presidential candidate Ted Cruz, Mr Obama said: "Where else could a boy born in Calgary run for president of the United States?"

A lavish state dinner was held for Mr Trudeau and his wife Sophie Gregoire-Trudeau, featuring poutine, Nanaimo bars and white chocolate snowballs.

During Mr Trudeau's toast, he referred to the 25,000 refugees from Syria who have arrived in Canada in the past four months, saying that "diversity can be a source of strength".

More than half of US governors oppose allowing refugees to settle in their states.

A new life in Canada for Syrian refugees

Can Trudeau be what Obama couldn't?

What Canadians make of the US election

Image copyright Getty Images Image caption "Here in America, you may well be the most popular Canadian named Justin", Mr Obama joked in a reference to Canadian pop star Justin Bieber

After a private meeting at the White House, Mr Trudeau said he had learned a lot from "my friend Barack", who he described as "a man of both tremendous heart and tremendous intellect".

Earlier, Mr Obama said the two leaders share "a common outlook" and that Mr Trudeau had brought "new energy and dynamism not only to Canada but to the relationship between our nations".

He added that the US and Canada were "blessed to be neighbours".

The leaders have pledged co-operation on liberalising investment and trade, promoting clean energy and preventing foreign fighters from travelling to the Middle East.

Image copyright Reuters Image caption Mr Obama said both countries "don't always express how valuable the alliance is"

Image copyright EPA Image caption The US and Canada would never agree on some issues - like whose beer is better, Mr Obama said

Mr Trudeau came bearing gifts for the First Family: a pair of Canadian-made dog boots called "Muttlucks" for the pet dogs, a beaded cape for Mrs Obama, an aboriginal statue for Mr Obama, and scarves for the president's daughters.

Ahead of the meeting, a joint statement on environmental cooperation announced that the US and Canada would cut methane emissions by 40-45% below 2012 levels, by 2025.

They also agreed to set "world class" standards on commercial activities in the Arctic, including oil and gas exploration.

US-Canada relations had previously suffered because of energy issues, when Mr Obama's administration opposed the Keystone XL pipeline, which was meant to transport oil from Canadian tar sands in Alberta to the US Gulf coast.

Image copyright AFP Image caption Despite occasional disagreements, the US and Canada are "united in a common purpose", Mr Trudeau said

Image copyright AFP Image caption The two leaders share a progressive political agenda

Image copyright Pete Souza Image caption The liberal Prime Minister has often been compared to Mr Obama

President Obama, 54, sees in the young leader a man who shares his progressive politics, as well as his early rhetoric of hope and change, the BBC's Barbara Plett-Usher reports from Washington.

Mr Trudeau's optimistic election platform has led many to draw comparisons with the beginning of Mr Obama's presidency and some American liberals to draw envious comparisons with the US's political scene.

As Donald Trump solidified his position as front-runner for the Republican presidential nomination earlier this month, there was even a spike in internet searches about how to move to Canada.

In Washington, Mr Trudeau chose his words carefully after being asked by reporters for his views on US-Canada relations under a Donald Trump or Ted Cruz presidency.

He said he looked forward to working with whomever US voters elected to the White House.