The US Supreme Court appeared sharply divided on 28 April along ideological lines on whether the Constitution guarantees a right to same-sex marriage, but Justice Anthony Kennedy, a pivotal vote, seemed open to legalising same-sex marriage nationwide.

In 2-1/2 hours of arguments, the justices peppered lawyers on both sides of the issue with questions in the landmark case.

At one point, a protester shouted that the justices would "burn in hell" if they backed same-sex marriage, then he was dragged screaming from the packed courtroom by police.

Kennedy, a conservative who often casts the deciding vote in close cases and has a history of backing same-sex rights, appeared to be tipping toward recognising a nationwide right to marriage based on his emphasis on the nobility and dignity of same-sex couples.

A lively crowd estimated at more than 1,000 people, with those favouring legalised same-sex marriage outnumbering those opposed, gathered outside the white marble courthouse as the justices heard arguments in the case, known as Obergefell v Hodges.

The justices, taking up a contentious social issue in what promises to be the year's most anticipated ruling, are due to deliver a decision by the end of June on whether same-sex marriage will be legal nationwide.

After the arguments plaintiffs in the case said they believed the court would rule in their favour.

"We stand before you one step closer to being a legalised, recognised family in the state of Michigan. We are honoured to be standing in front of all of you," said plaintiff April DeBoer from Michigan.

"We deserve the same respect that any other couple. I have friends who have joined me in this case who are raising children. They are committed married couples with children. They deserve the same rights, respect, and responsibilities as every other family in our country. Our country is based on the Constitution and the Constitution demands equal rights and treatment under the law," said plaintiff James Obergefell.

The court's four liberal justices seemed willing to vote in favour of same-sex marriage, while the court's conservatives, including Chief Justice John Roberts, appeared inclined to back the right of states to restrict the definition of marriage.

Roberts gave no sign that he is likely to join the liberals. He, like Kennedy, stressed the swift changes in attitudes to same-sex marriage and questioned whether it was the court's role to decide it once and for all.

Other conservatives also posed tough questions to Mary Bonauto, the lawyer arguing in favour of same-sex marriage.

Justice Antonin Scalia questioned whether religious ministers who oppose same-sex marriage would be required to officiate over ceremonies. Similarly, Justice Samuel Alito asked whether incestuous or bigamous relationships could be allowed if the court embraced same-sex marriage.

The arguments centre on same-sex marriage bans in Kentucky, Michigan, Ohio and Tennessee, four of the 13 states that currently prohibit it.

Public support for same-sex marriage has steadily grown in recent years and is particularly strong among younger Americans.

Before same-sex marriage became legal in Massachusetts in 2004, it was not permitted in any state. Now it is allowed in 37 states and Washington, DC.

The arguments were divided into two parts. The first was on whether the Constitution's guarantees of due process and equal protection under the law mean states must allow same-sex couples to marry. The second concerned whether states must recognise same-sex marriages occurring out-of-state.

Opponents say same-sex marriage legality should be decided by individual states, not judges. Some opponents argue it is an affront to traditional marriage between a man and a woman and that the Bible condemns homosexuality.

President Barack Obama's administration argued on the side of same-sex marriage advocates. He has said he hopes the court issues a ruling preventing states from banning same-sex marriage.