A federal judge ruled Thursday that Mississippi's ban on same-sex couples adopting children is unconstitutional, making gay adoption legal in all 50 states.

U.S. District Judge Daniel Jordan issued a preliminary injunction against the ban, citing the Supreme Court's decision legalizing same-sex marriage nationwide last summer. The injunction blocks Mississippi from enforcing its 16-year-old anti-gay adoption law.

The Supreme Court ruling "foreclosed litigation over laws interfering with the right to marry and rights and responsibilities intertwined with marriage," Jordan wrote. "It also seems highly unlikely that the same court that held a state cannot ban gay marriage because it would deny benefits -- expressly including the right to adopt -- would then conclude that married gay couples can be denied that very same benefit."

The challenge to Mississippi's law was filed last year by four same-sex couples, who were joined by the Campaign for Southern Equality and the Family Equality Council.

“Two sets of our clients have waited many (almost 9 and 16) years to become legal parents to the children they have loved and cared for since birth," Roberta Kaplan, lead attorney for the plaintiffs, said in a statement. "We hope that it should finally be clear that discrimination against gay people simply because they are gay violates the Constitution in all 50 states, including Mississippi."

The Human Rights Campaign's Mississippi state director Rob Hill also praised the ruling.

"This welcome decision affirms that qualified same-sex couples in Mississippi seeking to become adoptive or foster parents are entitled to equal treatment under the law, and commits to the well-being of children in our state who need loving homes," he said in a statement. "Judge Jordan has repudiated reprehensible efforts by our elected leaders to deny legal rights to our families. They are on the wrong side of history, and today's decision confirms, yet again, that they are also on the wrong side of the law."

The one-sentence Mississippi law -- which reads, simply, "Adoption by couples of the same gender is prohibited" -- was adopted in 2000. While several other states, including Alabama, Florida, Nebraska and Michigan, had similar bans, all have since been overturned.

Mississippi remained the lone holdout until Thursday's ruling. (Some states still have restrictions on fostering children, however, and other roadblocks for same-sex couples remain.)

In a 2013 blog post for The Huffington Post, former Mississippi Gov. Ronnie Musgrove, who signed the adoption bill into law, said he supported overturning it.

"This decision that all of us made together has made it harder for an untold number of children to grow up in happy, healthy homes in Mississippi -- and that breaks my heart," Musgrove wrote.

The ruling came soon after Mississippi's Senate passed a "religious freedom" bill, which would give businesses the right to deny service to LGBT people.

Read the judge's ruling below: