His agenda stalled and his party divided, President Donald Trump veered into the nation's simmering culture wars by announcing plans to ban transgender people from serving in the military.

Much of the political world — prominent conservatives and Trump administration officials, among them — was surprised and confused by the president's sudden social media pronouncement. But on the ground in North Carolina, Tami Fitzgerald was elated.

"It was pretty high up on our wish list," said Fitzgerald, executive director for North Carolina Values Coalition, which has fought for that state's so-called "bathroom bill." Fitzgerald said she found it "ridiculous" that the American taxpayers were being forced to pay for treatment and surgery that violates the conscience of most of the American public."

Trump's abrupt announcement amounted to a direct political lifeline to his most passionate supporters. In his chaotic first six months in office, Trump has lost sizable support from independents and some Republican voters. But polls show white evangelicals remaining loyal — and essential to stabilizing his political standing.

"Pray for him as he faces critics and opposition," evangelical leader Franklin Graham wrote of the president Wednesday on Facebook, describing the transgender ban as "a bold move."

Trump tweeted earlier in the day his plan to block transgender people from serving in the U.S. military "in any capacity," citing "tremendous medical costs and disruption." The White House did not say what would happen to those thousands of transgender troops already serving. The announcement signals a reversal from President Barack Obama's decision to open the armed services to transgender people, a policy that also required the Pentagon to pay for gender transition surgeries and hormone therapy.

The issue was barely on the radar for some national conservative leaders, who said privately they were far more concerned with de-funding Planned Parenthood, protecting religious freedom, and amending the tax code to allow non-profit religious organizations to engage in politics.

But for Christian conservatives across middle America who make up much of Trump's base, Wednesday's announcement served as a powerful reminder that he remains committed to their values. For emphasis perhaps, Trump followed his morning tweet with an afternoon message in all capital letters: "IN AMERICA WE DON'T WORSHIP GOVERNMENT - WE WORSHIP GOD!"

In Iowa, outspoken social conservative Steve Scheffler praised Trump's decision and lamented the evolution of the LGBT movement.

"Ten years ago, we wouldn't have even been talking about these issues where people can't figure out what gender they are," said Scheffler, a Republican national committeeman. "It's pretty sad we're at this point."

It may not be front and center in Washington, but in city halls and statehouses, debates continue to rage over LGBT rights, particularly as transgender people seek access to bathrooms and locker rooms that match their gender identities.

Trump largely sidestepped the issue before the election, vowing instead to defend LGBT rights. In the spring of 2016, he invited transgender reality star Caitlyn Jenner to use whichever bathroom she chose at Trump Tower.

But after six months in office, he's in desperate need of political momentum.

The Republican president has yet to convince the Republican-led Congress to enact any major legislation. An independent investigation probing Russian interference in the 2016 election has expanded to Trump's closest aides. And the president is publicly quarreling with Attorney General Jeff Sessions, his most loyal Cabinet member.

Trump won over 81 percent of white evangelical voters in the 2016 election, according to exit polls. The Pew Research Center found this spring that Trump's approval rating was twice as high among white evangelical Protestants than the general public.

As his overall approval ratings hover near historic lows, however, he can ill afford to lose the core constituency.

Even before Wednesday's announcement, Trump had been working on his relationship with religious conservatives.

In May, he addressed graduates at Liberty University, the nation's largest Christian college. Earlier in the month, he prayed with more than two dozen evangelical leaders in the Oval Office. And earlier in the week, Christian leaders rallied behind Trump's son-in-law Jared Kushner as he faced congressional investigators.

Caught off-guard by Wednesday's announcement, some evangelical leaders like Liberty University President Jerry Falwell Jr. declined to comment about the transgender ban. Those who did speak out were overwhelmingly supportive.

Robert Jeffress, pastor of the First Baptist Church of Dallas, praised Trump for taking on "the militant liberal agenda." ''Thank God for a President who is willing to say, 'Enough is enough!'" he said.

"It is heartening to have a commander-in-chief who puts the expert opinions of his generals and military officials ahead of the destructive forces of political correctness and identity politics," declared Christian evangelist James Dobson.

At the same time, however, Trump's announcement troubled moderate Republicans who hoped the president would treat all Americans equally.

"This came out of nowhere," said Gregory T. Angelo, president of the Log Cabin Republicans. He said Trump's focus on transgender soldiers "only serve to exacerbate ongoing culture wars around LGBT issues."

Joe Murray, a Mississippi-based attorney who administers the LGBTrump Facebook page, said he's not sure whether the transgender ban "will energize the base or demoralize the base."

"The one thing I know about President Trump is that he's always five steps ahead," Murray said. "I don't know if they're always good steps ahead."