U.S. Supreme Court Justice Anthony Kennedy has likened the court's recent ruling striking down marriage bans in all 50 states to a case in which the court decided that burning an American flag is protected free speech.

Kennedy made his remarks during the closing day of the annual Ninth Circuit Judicial Conference in San Diego.

The 1989 case was also narrowly decided with Kennedy acting as the swing vote.

He told judges and lawyers attending the conference that both cases were controversial, according to the AP.

He said that the public came around in the previous case after two or three months.

Kennedy said that a German prisoner during World War II who was outraged by the flag-burning decision reversed course after he read Kennedy's concurring opinion.