U.S. senators on Tuesday passed a bill protecting federal recognition of same-sex marriages. The passage was prompted by concerns that the Supreme Court could overturn a 2015 decision that legalized same-sex marriage nationwide, the Voice of America reports.

The narrowly tailored bill, which requires the federal government to recognize a marriage if it was legal in the state in which it was performed, is meant to protect against a possible Supreme Court ban on same-sex marriage.

However, it would not prevent states from banning same-sex marriages if the Supreme Court allows them to do so.

The bill would give millions of same-sex and interracial same-sex couples certainty and certainty that their marriages are valid and will remain valid into the future, Democratic Senator Tammy Baldwin, one of those who pushed for the legislative initiative, said Tuesday before the bill passed.

Baldwin became the first openly gay member of the Senate in U.S. history. According to the Census Bureau, there are about 568,000 married same-sex couples in the United States.