Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

NEW YORK — Two LGBT-rights organizations filed a lawsuit in federal court Wednesday challenging President Donald Trump's tweets declaring he wants a ban on transgender people serving in the military.

The suit was filed in U.S. District Court in Washington on behalf of five transgender service members with nearly 60 years of combined military service.

Related: Trump Bans Transgender People Serving in the Military

Transgender people have been allowed to service openly in the military since June 2016. Trump, in a series of tweets on July 26, announced that he planned to end that policy.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The government "will not accept or allow transgender individuals to serve in any capacity in the U.S. military," he tweeted, contending that their service entailed "tremendous medical costs and disruption."

The lawsuit, filed by GLBTQ Legal Advocates & Defenders (GLAD) and the National Center for Lesbian Rights, says such a ban is unconstitutional, denying transgender service members equal protection and due process.

Dozens hold "Resist" signs near a Times Square military recruitment center to show their anger at Trump's decision to reinstate a ban on transgender individuals from serving in the military on July 26, 2017, in New York. Spencer Platt / Getty Images file

Lawyers handling the lawsuit said they hoped the court would move swiftly to prevent a ban from taking effect, given the uncertainty that transgender service members now face in regard to their livelihoods and retirement benefits.

"The damage is happening now," said Jennifer Levi, Director of GLAD's Transgender Rights Project. "These service members were told in June 2016 they could come out and continue to openly serve."

The five plaintiffs — who were not identified in the lawsuit — serve in the Air Force, the Coast Guard and the Army. Their years of service range from three years to two decades, and include tours in Iraq and Afghanistan.

The Pentagon had no immediate comment.

Named in the suit, along with Trump, are Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, and other national security officials.

Related: Trump Claims Transgender Service Members Cost Too Much: But Is That True?

When Trump first tweeted his plan, Dunford said the military would not act on the tweets until a formal order to do so was issued by the president, who is also the commander-in-chief of the military. But a team of military lawyers has been pulled together to figure out how to handle the matter.

The American Civil Liberties Union says it told the White House on Tuesday that it intends to sue, and requested that relevant documents be preserved in preparation for the lawsuit.