U.S. President Barack Obama declared solidarity between the United States and economically struggling Ireland with a symbolic gulp of beer and a rousing speech, telling a huge Dublin crowd on Monday: Your best days are still ahead.

Beginning a four-nation European tour with a celebration of his Irish roots, Obama came to Ireland as what one man called a long-lost cousin.

Crowds packed the streets for both a stirring speech in Dublin and a visit to the tiny village of Moneygall, where an ancestor of Obama's lived before moving to the United States.

Introduced by Irish Prime Minister Enda Kenny as the American Dream come home, Obama told the throng in central Dublin: My name is Barack Obama, of the Moneygall Obamas.

For Ireland, Obama's arrival, and the visit of Britain's Queen Elizabeth last week, are a welcome distraction from the global attention paid to its financial woes and the ensuing international bailout.

Obama was also due to visit Britain, France and Poland on a week-long trip whose agenda includes talks on issues as Afghanistan and Pakistan after the killing of Osama bin Laden, the world economy and the Arab spring uprisings.

AUSTERITY

Ireland's economic slump has led to a debt crisis and drastic government spending cuts. Apart from lifting the spirits of the Irish, the visit looked set to provide some powerful images back home for Obama's 2012 re-election campaign.

He brought back the signature phrase from his 2008 presidential campaign, Yes we can, but said it in Gaelic.

This little country that inspires the biggest things -- your best days are still ahead, Obama said.

And Ireland, if anyone ever says otherwise ... remember that, whatever hardships winter can bring, springtime is always just around the corner and, if they keep on arguing with you, just respond with a simple creed, 'Is feidir linn', Yes we can.

At O'Neill's pub in Dublin, revellers cheered and some chanted USA! USA! as the president emerged on stage for his speech.

I think it will give the country a great lift, the kind of lift we desperately need, said Jennifer Kearney, a mother of two who brought her two daughters aged 13 and 15 into Dublin's city centre for the event.

In Moneygall, Obama hoisted a glass of Guinness stout at Ollie Hayes's pub as fiddle music played, and his wife Michelle pulled pints at the bar.

Thousands of rain-drenched people lined the village's one street, festooned with American flags, and roared with delight as the motorcade rolled in.

The sleepy village of 300 was the birthplace of Obama's great-great-great grandfather, Falmouth Kearney, a shoemaker who left in 1850 to begin a new life in the United States.

This makes Obama, the son of a Kenyan father and Irish-American mother, one of 37 million Americans who claim Irish ancestry.

LONG-LOST COUSIN

I'm here to see Obama ... our long-lost cousin, said Moneygall resident Rob Lewis, 28.

Inside the pub, which was lined with framed photos of Obama, the president met Henry Healy, a 24-year-old distant cousin. He joked with the bartender to make sure the Guinness had settled properly before he and Michelle took sips.

I don't want to mess this up, he said before saluting the bar with a Slainte -- Irish for 'cheers' -- and a long gulp.

You look a little like my grandfather, he said to one of the men inside.

Back out on the street, three babies were handed over a security barricade for pictures to be taken with Obama, and women hugged and kissed him under the watchful eye of his security detail.

Moneygall is capitalising on its famous connection, selling everything from Obama fridge magnets to Obama plastic lighters.

T-shirts with slogans such as What's the craic, Barack? (How are things? What's going on?) and Is feidir linn are top-sellers.

Irish radio offers frequent airings of the popular song There's no one as Irish as Barack Obama, playing on a surname that almost sounds typically Irish.

We're a tiny nation of 4 million people so it's a lovely gesture him coming over. Given that we've had the queen as well it's been a momentous week. It's a lift for Ireland, said Susannah Moore of Dublin.

Obama was forced to leave for London for the next stop of his trip on Monday night rather than Tuesday due to a new volcanic ash cloud from Iceland.