The U.S. House on Thursday approved an amendment that reverses President Donald Trump's ban on transgender troops.

The legislation would also prohibit the U.S. Military from discriminating against service members who identify as lesbian, gay, bisexual, or transgender.

The amendment cleared the chamber on a mostly party-line vote of 242-187. Ten Republicans joined a united Democratic caucus in voting for the measure. Trump's ban on transgender military service went into effect roughly four months after the Supreme Court gave its okay as several cases challenging the ban's constitutionality move through the courts.

California Representative Jackie Speier, a Democrat, introduced the amendment to the fiscal year 2020 defense authorization bill.

In a statement, Speier called passage a “watershed moment in the fight to celebrate and protect open transgender military service.”

“Courageous transgender servicemembers continue to fight for our country despite the president’s hateful ban and deserve to know we stand with them,” Speier said. “Our country has a shameful history of preventing people from serving based on bias, ignorance and malice. This is the first time Congress has voted to ensure that no discriminatory standard based on race, religion, national origin or sex can prevent qualified individuals from serving their country. Our military is strongest when it embodies our nation’s values.”

The Human Rights Campaign (HRC), the nation's largest LGBT rights advocate, cheered passage of the amendment.

“Transgender troops have served openly with distinction for years, and they and their fellow service members deserve nothing less than the respect of a grateful nation,” HRC National Press Secretary Sarah McBride said in a statement. “The Trump-Pence administration’s trans troop ban goes against medical experts, military leadership and budget analysts; it is unsound, unpopular, and unpatriotic. We are grateful to Congresswoman Speier and the strong, bipartisan majority of the House who voted for this amendment to ensure all transgender military service members have equal non-discrimination protections.”