Media playback is unsupported on your device Media caption Hot tempers and dance parties outside US Supreme Court

The justices of the US Supreme Court have questioned the meaning of marriage and the government's role in defining it, as they weigh whether the state of California may ban same-sex nuptials.

Following Tuesday's arguments, the court could uphold the 2008 ban, narrowly overturn it, or invalidate all state same-sex marriage bans in the US.

The ban's defenders argued the issue should be decided by individual states.

Recent opinion polls have shown a rapid rise in support for same-sex marriage.

Questions on children

As arguments began on Tuesday, justices first discussed whether the organisation defending the ban, known as Proposition 8, had legal standing to bring the case to the high court.

Analysis The protesters and campaigners chanting in the cold sunshine today may yet be disappointed. The court that ended school segregation and legalised abortion appears to be shying away from a ground-breaking decision on gay marriage. All eyes are on Justice Anthony Kennedy, the swing vote in a court generally evenly divided between liberals and conservatives. This morning he seemed to have been uncomfortable with the case, describing the issue as "uncharted waters" and asking whether the case should have come to the Supreme Court. The court may decide simply not to rule on the case. That would leave same-sex marriage effectively legal in California. But it would not be the sweeping change some gay rights campaigners were hoping for.

Proposition 8 was approved by California voters in a referendum in November 2008, but the state government declined to defend it in federal courts.

If the justices rule that the ban's supporters have no such standing, they would invalidate only the California law while leaving same-sex marriage bans standing in dozens of other states. That is because lower courts have already overturned the ban.

The Supreme Court justices also discussed whether the ability to procreate was crucial to the legal definition of marriage.

"There are lots of people who get married who can't have children," Justice Stephen Breyer said after a lawyer in support of the ban, Charles Cooper, argued that procreation and child-rearing were fundamental to a state's interest in marriage.

Justice Ruth Bader Ginsburg also brought up a previous Supreme Court case in which justices ruled prison inmates have a right to marry even though they may be prevented from procreating.

Justice Anthony Kennedy, often seen as a swing vote between the four conservative and four liberal justices, suggested that children of same-sex couples would suffer an "immediate legal injury" under the ban.

Media playback is unsupported on your device Media caption The BBC's Jane Little meets crowds who have queued for days for a seat at the hearings

But he also said he feared the court would enter "uncharted waters".

"We have five years of information to pose against 2,000 years of history or more," he said.

Chief Justice Roberts said he was unsure prohibiting same-sex couples from marrying denied them rights, while Justice Sonia Sotomayor asked Mr Cooper what injury same-sex marriage would cause the ban's defenders.

Rise in support

Justice Samuel Alito appeared to sound a note of caution.

"You want us to step in and render a decision based on an assessment of the effects of this institution which is newer than cellphones or the internet?" he said. "I mean, we do not have the ability to see the future."

Supporters of same-sex marriage were in the majority outside the US high court as the morning began, says the BBC's Steve Kingstone.

But then hundreds of Proposition 8's defenders turned up, accompanied by a band of kilted pipers, and there were arguments between the antagonists, our correspondent reports.

On Wednesday, the Supreme Court will hear another case on same-sex marriage: a challenge to a federal law defining marriage as between a man and a woman only. The 1996 law, the Defense of Marriage Act, denies federal tax and other benefits to same-sex married couples.

Image caption Recent opinion polls have shown rapid growth in US public support for gay marriage

Both cases are expected to be decided by June.

Currently, nine US states and Washington DC permit same-sex marriage. Twelve other states allow civil unions or domestic partnerships that provide varying degrees of state marriage benefits, but do not allow couples to marry.

Recent opinion polls have shown a rapid growth in public support for the issue, with most Americans now believing it should be legal.

The Supreme Court cases follow a flurry of declarations in support of gay marriage by high-profile figures, including last week by former Secretary of State Hillary Clinton.

Days earlier, Ohio's Rob Portman became the first Republican senator to back gay marriage.

And now three Democratic senators - Claire McCaskill of Missouri, Mark Warner of Virginia and Jay Rockefeller of West Virginia - have adopted the same stance.