California's Supreme Court has annulled more than 4,000 gay marriages in San Francisco.

The court found that the city acted improperly in granting the marriage licenses earlier this year in defiance of state law.

The city's mayor sparked a passionate debate across the US in February by allowing 4,037 same-sex couples to wed over a four-week period before the California high court halted the ceremonies.

A California law, backed by a voter referendum, defines marriage as a union of man and women, and polls show most Californians continue to oppose gay marriage.