The US Supreme Court has heard arguments in a historic case that could legalise same-sex marriage nationally.

Outside the court, protesters for and against rallied with signs, music, and preaching - reflecting the deep and sometimes bitter national divide.

Inside, the proceedings were interrupted by someone shouting that the justices would "burn in hell" if they were to back gay marriage.

Currently, 36 of the 50 US states allow same-sex couples to marry.

Based on their questions, the nine justices appeared divided on the issue.

The court is also determining whether to require states to recognise marriages performed in other states.

Justice Anthony Kennedy, whose vote could prove pivotal on the issue, said marriage has been understood as being between one man and one woman for "millennia-plus time".

He also questioned whether scholars and the public had had enough time to debate the issue.

But he also challenged John Bursch, a lawyer representing the states that ban same-sex marriage, to explain how the legalisation of same-sex marriage would harm traditional marriages.

For his part, Mr Bursch argued that child-rearing is the central rationale for marriage. Removing it would weaken people's commitments to stay together because of children they share.

The case - Obergefell v Hodges and the consolidated cases - carries the name of Jim Obergefell, an Ohio resident who was not recognised as the legal widower of his late husband, John Arthur.

Mr Obergefell said to the BBC's Gary O'Donoghue outside the court on Tuesday: "I'm here today to continue fighting for my husband, for our marriage, to continue to honour and protect him."

At the scene - Paul Blake, BBC News

Image caption Pastor Larry Hickam

Traditional rainbow flags and the newer "equal sign" flags, emblematic of the gay rights movements, fluttered in the spring breeze alongside signs denouncing homosexuality as sin.

For many there, including Pastor Larry Hickam from Amarillo, Texas, the issue is a matter of religious belief.

"I'm not trying to be mean or ugly, it's just what God said," he said as he cited biblical verse and explained his belief that marriage should be between a man and woman.

Image caption John Hall and Rio Franciosa

"The Supreme Court can do want whatever they want, but the Supreme God has already spoken," he said.

A few feet away, Rio Franciosa and his boyfriend John Hall held hands as they watched Mr Hickam and others preach.

At one point, Mr Franciosa quipped: "If people in 500 years read Harry Potter, they will think we played quidditch."

On the sidewalks outside the court, the argument against expanding same-sex marriage rights appeared to be largely based in religious belief.

Inside however, the argument is rooted in a broader debate over states' rights.

"The case is not about the best marriage definition. It is about the fundamental question regarding how our democracy resolves such debates about social policy." Mr Bursch wrote in his main brief to the court.

The lawyers' arguments and the justices' questioning gives the public its first glimpse into the court's thinking on the matter.

The justices are considering whether the US Constitution's 14th Amendment require every state to grant a marriage licence to two people of the same sex.

And they are also pondering whether the same amendment requires every state to recognise a marriage between two people of the same sex that was performed lawfully in another state.

The first state to allow same-sex marriage was Massachusetts, which granted the right in 2004. Today, same-sex couples can marry in 36 states and the federal district of Washington, DC.

Photos by Paul Blake