TAIPEI, Taiwan — In a ruling that paves the way for Taiwan to become the first place in Asia to recognize same-sex marriage, the constitutional court on Wednesday struck down the Civil Code’s definition of marriage as being only between a man and a woman.

The legislature now has two years either to amend the Civil Code or to enact laws addressing same-sex couples.

If the legislature fails to pass an amendment or legislation in the next two years, same-sex couples “shall be allowed to have their marriage registration effectuated at the authorities in charge of household registration,” the court wrote in a news release.

When the ruling was announced, cheers broke out among the hundreds of supporters who had gathered outside the legislature, monitoring developments on a big-screen television.