Senator Joni Ernst, an Iraq War veteran. Photo: Scott Olson/Getty Images

When President Trump got online this morning and tweeted that transgender troops will no longer be allowed in the U.S. military, it caught the Pentagon and many GOP lawmakers by surprise. Hours later, the White House is likely surprised too, because rather than greeting Trump’s announcement with the glee officials appear to have expected, some GOP lawmakers are ripping the ruling.

Senators John McCain and Joni Ernst, who both served in the military, were among the first to speak out against the all-out ban on transgender troops.

“Any American who meets current medical and readiness standards should be allowed to continue serving,” McCain said in a statement. “There is no reason to force service members who are able to fight, train, and deploy to leave the military — regardless of their gender identity.”

In a statement, a spokesperson for Ernst said, “She believes what is most important is making sure service members can meet the physical training standards, and the willingness to defend our freedoms and way of life. Americans who are qualified and can meet the standards to serve in the military should be afforded that opportunity.”

Senator Richard Shelby joined his colleagues, telling CNN that everybody should have “a chance to serve.”

.@SenShelby on transgender military ban: "You ought to treat everybody fairly & give everybody a chance to serve" https://t.co/Xj3yDt3QUH — CNN Newsroom (@CNNnewsroom) July 26, 2017

A fourth Republican Senator, Utah’s Orrin Hatch, joined his colleagues after declaring on Twitter that he stands with “transgender Utahns.”

In a written statement to USA Today Hatch went further than the other senators and suggested that transgender people should not only be allowed to serve, but that “[t]ransgender people are people, and deserve the best we can do for them.”

As the critiques of Trump’s tweets poured in, Politico revealed Wednesday afternoon that he made the announcement after House Republicans asked him to ban the Pentagon from paying for surgery allowing servicemembers to transition.

No one was even asking him to ban transgender troops. But he did it anyway, because as one official told Politico, “It’s not the worst thing in the world to have this fight.” The White House just didn’t think it would be having this fight with members of its own party.