Dublin, Ireland (CNN) Irish voters went to the polls Friday to decide whether to change the country's constitution to allow same-sex marriage .

Counting will start Saturday morning, with the result due by the end of the day.

It's a landmark referendum that, if passed, would make Ireland the first country in the world to legalize same-sex marriage through a popular vote.

Ireland's voters were asked to approve this statement: "Marriage may be contracted in accordance with law by two persons without distinction as to their sex."

If more say "yes" than say "no," the change to the constitution will give gay and lesbian couples the right to civil marriage, but not to be wed in a church.

The referendum was a social media sensation, with many Irish people returning from abroad to vote in favor of same-sex marriage, then joyfully telling the world about it using the #HometoVote hashtag.

#HometoVote - Irish emigrants return en masse to vote on gay marriage, this is their story http://t.co/lsrRYmGayy — Channel 4 News (@Channel4News) May 22, 2015

Seeing the amount of people here in the airport who are #hometovote has me in floods! I feel very proud to be Irish right now 💚 — Melanie Murphy (@melaniietweets) May 22, 2015

‎@melaniietweets Tweeted, "Seeing the amount of people here in the airport who are #hometovote has me in floods! I feel very proud to be Irish right now."

@davidmrsn said on Twitter, "Took a few days to get #hometovote from Nepal but getting job done with the family #VoteYes #MarRef #MakeGraTheLaw"

As in many other countries around the world, the issue is a polarizing one. And the referendum will be a test of whether in Ireland, a majority Catholic nation, more liberal thinking wins out over conservative, traditional leanings.

Opinion polls before the vote suggest that the "yes" vote is on track to come out on top, but that the gap is narrowing.

A CNN team at a polling station south of central Dublin saw a steady stream of voters heading to the ballot box.

One, 46-year-old Tim Mudie, from Dublin, said, "I voted yes. It's outrageous that my gay and lesbian friends are not able to do what they want to do."

Another, Mary Harrington, said she would vote yes because everyone should have the same rights, adding that she was optimistic that if turnout is high, the referendum will pass.

"A right is a right. It's 'yes' all the way. We shouldn't even be voting on this issue," she said.

Not everyone feels the same way, however. And it's clear the run-up to the referendum has been bruising for some.

Joanna Jordan, of Dublin, opposes the constitutional change.

"I'm voting no because as far as I'm concerned, marriage has always been between a man and a woman since the beginning of time and there's no reason to change it," she told CNN on the eve of the poll. "Marriage is basically to set the scene for children to come into the world in the best possible way."

She says she believes the debate has been too polarizing to be sure which way the referendum will go.

"It's so divisive, people aren't talking about it, and Irish people love to talk!" she said. But if the referendum passes, "I would be sad for the country because family is so important, and the foundation of the state is the family, and if you break the foundation, you break the state."

There have now been more than 72,000 #HomeToVote mentions on Twitter since 5pm last night http://t.co/tbp6gObwrN pic.twitter.com/6wuceDV31l — Twitter Dublin (@TwitterDublin) May 22, 2015

Daithi Galvin, 40, a self-described devout atheist, told CNN he would be voting yes "because Ireland deserves to be an equal community" in which "everyone, whether you be young or old, or black or white, or rich or poor, man or woman, has the right to be happy."

But he said he feared the fierce debate -- and a "yes" campaign some have seen as aggressive -- might have led to the degree of support for the measure to be overstated.

"There are people out there who will feel that they can't publicly say no, but that's the idea of democracy, that democracy should allow people to say yes or no because that's their opinion," he said.

Prime Minister: 'Obliterate' prejudice

Sunday Times/Behaviour and Attitudes Poll published Sunday indicated 63% of those surveyed supported the change, with 26% opposed and 11% undecided. That represented a 10% drop in support for the measure since March.

An Irish Times/Ipsos MRBI poll last week suggested that 70% of voters who had made up their minds on the issue were in favor of the change to the constitution, and only 30% opposed it. The poll did not include those who were undecided, which came to 17% of respondents.

Prime Minister (or Taoiseach) Enda Kenny told TV3's "Ireland AM" program last week that he believed the referendum would be close but that he was "confident it will be passed."

Took a few days to get #hometovote from Nepal but getting job done with the family #VoteYes #MarRef #MakeGraTheLaw pic.twitter.com/v9Jhc4lXNL — David M (@davidmrsn) May 22, 2015

Speaking this week, Kenny confirmed he himself would be voting yes. He added that the country could "create history" and that a "yes" vote would "obliterate" prejudice along with irrational fears of difference.

Any change to the constitution has to be put to a referendum. The decision to put the question to the vote in the first place was born out of consultation with members of the public.

In other countries that allow same-sex marriage, the decision was made by the government or the courts.

'About civil marriage equality'

Ireland's "Yes" campaign has been spearheaded by an umbrella group called Yes Equality , established by gay rights campaign groups, with the backing of civic society groups and grassroots campaigners across the country.

It also has the support of Ireland's political parties.

The right to civil partnership for same-sex couples in Ireland was introduced in 2010. But on its website, Yes Equality argues that it differs significantly from marriage in the level of recognition and protection it affords to same-sex couples and their families.

The outcome of the referendum won't have any bearing on surrogacy or adoption rights, it says.

It also represents no threat to religious freedom, it says. "The referendum is about civil marriage equality. Churches will be able to continue with religious ceremonies and will not be required to conduct wedding ceremonies for same-sex couples."

@caitstaunton @ireland i think y are a bit gaga — LOGISCH FAKTISCH (@LogischFaktisch) May 22, 2015

Allowing lesbian and gay people to get married will have no impact on anyone else's marriage, the group says.

"Irish people are fair-minded, welcoming and confident. This referendum is about making our laws reflect those values."

For Pat Carey, 67 and a former minister for equality, the path to the referendum has been a personal journey as much as a political one.

"I'm a former minister of a former government who at the ripe old age of 65 summoned up the courage to tell his family and friends that he was gay," he told CNN.

No longer in politics, he has now embraced the role of advocate for change. "I have been talking about people like myself for the last three months, and there are many of us, living in very lonely and isolated conditions -- and that's not just people living in rural Ireland, that's people living in mentally very isolating conditions.

"And I think if we've done nothing else, we've given some confidence back to that generation that a younger generation cares about them too, and that if this vote goes the right way on Friday, we'll be living in a more generous, kinder and gentler Ireland."

Called a threat to religious freedom

Opposition to the constitutional change has been largely organized by Catholic groups that have focused on a message of protecting the traditional family.

video produced by one such group, Mandate for Marriage , argues that "redefining marriage" is a global threat to religious freedom pushed by "homosexual activists" and has been rejected by voters elsewhere, including some states in the U.S.

It also posits that redefining marriage is bad for parents and children. "Without exception, every child reared by a same-sex couple is denied either a father or a mother," the narrator states.

John Murray, chairman of the Iona Institute, a conservative Catholic think tank that advocates for the "No" campaign, takes a similar view.

"The union between a man and a woman should be defended," he told CNN. "We believe that it's under very serious threat, this aim to change it into a gender neutral institution completely.

"And doing this we think will endanger children because it will deprive children of a mother or a father deliberately, with the backing of the state in the future."

@historytiia What a feeling to be a tangible part of history. The atmosphere is unprecedented. — Maurice J. Casey (@Muggwoffin) May 22, 2015

The Catholic Church, while its position in Ireland has been eroded by a series of child sex abuse scandals involving the clergy, still wields considerable influence with more traditional sectors of society.

While the church has not told churchgoers which way to vote, Catholic bishops sent out letters over the weekend to be read out at Mass in their parishes.

In his note , Catholic Archbishop of Dublin Diarmuid Martin urged voters to "consider very carefully the profound implications" the constitutional change might have for families.

"I know that the severity with which the Irish Church treated gay and lesbian people in the past -- and in some cases still today -- makes it difficult for some to understand the church's position," he said.

"The change is not simply about extending marriage rights to others; it is not just a debate about religious views; it is a fundamental change in the philosophy which underpins cohesion in society and thus affects and concerns every citizen."

Martin also recalled that in the debates on same-sex marriage in Argentina, Pope Francis had made clear he was opposed to it, but "he was consistent in telling people not to make judgments on any individual."

Gay cake row

The divisive nature of the issue came to the forefront in neighboring Northern Ireland this week, where a bakery lost a high-profile discrimination case after refusing to bake a cake with a slogan supporting same-sex marriage.

JUST WATCHED Gay rights activists win battle over 'Bert & Ernie' cake Replay More Videos ... MUST WATCH Gay rights activists win battle over 'Bert & Ernie' cake 01:39

Same-sex marriage is not legal in Northern Ireland, but it is in the rest of the United Kingdom.

Other nations allowing gay marriage include Canada, Brazil, Argentina, France, Portugal, the Netherlands, Spain, Finland, New Zealand and South Africa.