Drag queen and gay rights activist Rory O'Neill, also known as "Panti", celebrates with gay marriage supporters at Dublin Castle on May 23, 2015
Dublin (AFP) - Ireland on Saturday became the first country in the world to approve gay marriage by referendum with an overwhelming 62 percent "Yes" vote, further denting the once all-powerful Irish Catholic Church.
Supporters packed into the grounds of Dublin Castle hugged, kissed and waved rainbow flags in a festival atmosphere as the result was announced, and parties in the capital's gay bars went on into the night.
The constitutional change allowing same-sex marriage was passed with only 38 percent voting against it. All of Ireland's 43 constituencies except one voted in favour of the measure.
"Today Ireland has made history -- the first country in the world to vote for equal marriage," Prime Minister Enda Kenny told reporters.
"With today's vote we have disclosed who we are: a generous, compassionate, bold and joyful people.
"Yes to inclusion, yes to generosity, yes to love, yes to equal marriage," he said.
The voter turnout was 60 percent -- much higher than in other recent referendums.
As she swept into the castle party in high heels, Rory O'Neill or "Panti Bliss", Ireland's foremost drag queen and a leading "Yes" campaigner, declared: "It's an amazing day to be Irish!"
Outside the main counting centre in Dublin, Grainne O'Grady, 44, and Pauline Tracey, 53, said the plan was to "celebrate, celebrate, celebrate".
"I'm just so happy I could burst. We were voting on whether we were equal in our own country," said O'Grady, wearing a "Yes Equality" T-shirt.
Celebrities and political leaders tweeted congratulations and US Vice President Joe Biden, who is of Irish descent, wrote: "We welcome Ireland's support for equality. #LoveWins".
The referendum asked voters whether or not they approved the statement: "Marriage may be contracted in accordance with law by two persons without distinction as to their sex."
Legalising gay marriage is a seismic change in Ireland, where the Roman Catholic Church has traditionally been a powerful force.
Homosexuality was illegal until 1993 and abortion is still banned except where the mother's life is in danger.
- 'Reality check' for Church -
The Archbishop of Dublin Diarmuid Martin told national broadcaster RTE that the Catholic Church now needed a "reality check".
"I think the Church needs to do a reality check right across the board... Have we drifted away completely from young people?" he said.
"It's a social revolution," said the archbishop, who had called for a "No" vote arguing that gay rights should be respected "without changing the definition of marriage".
The Catholic Church campaigned strongly for a "No" vote, insisting marriage can only involve a man and woman, drawing support from many older voters.
The majority of Irish people identify themselves as Catholic, but the Church's influence has waned in recent years amid growing secularisation and after a wave of child sex abuse scandals.
All Ireland's main political parties supported amending the constitutional definition of marriage.
A string of Irish celebrities had also backed the "Yes" campaign including singer Sinead O'Connor, actor Colin Farrell and rock band U2, who posted a photo on Instagram with the words "In the name of love..." -- one of their most famous songs.
The issue has drawn intense interest on social media under the hashtag #MarRef and was one of the most popular trending subjects worldwide on Twitter Saturday.
Many young Irish voters posted selfies of themselves returning from overseas by plane and ferry to vote in favour of gay marriage in Friday's referendum.
- 'Ireland has changed' -
Ireland will be the 19th country in the world to legalise gay marriage, and the 14th in Europe.
Parliament first has to pass specific legislation and is expected to approve the bill within months, Justice Minister Frances Fitzgerald told AFP.
The first same-sex weddings could then take place in Ireland towards the end of the year.
Across the border in Northern Ireland, gay marriage is banned even though it is legal in the rest of the United Kingdom.
The historic shift brought up raw emotions at the gathering in Dublin Castle, the former centre of British power in Ireland.
Karen Brady, 27, said she had flown home to Ireland from Vancouver in Canada to vote.
"I voted with my parents -- it was such a memorable and moving moment," she said.
"I was nearly in tears because a few years ago, Ireland was not like that and my parents would not have accepted me. But Ireland has changed."