Pennsylvania state Senate leader Jake Corman was dropping out of the Republican primary for governor. Then he changed his mind.

Shortly after filing a petition in state court Tuesday to remove his name from the ballot for the May 17 primary election, Corman released a statement saying he wasn’t going anywhere. He cited a conversation with Donald Trump and the former president’s withering criticism of a rival candidate for the about-face.

“Two developments today have led me to decide to remain in the race for governor: President Trump’s statement on the race and my conversation directly with the president,” Corman said, referring to Trump’s statement earlier in the day calling former U.S. Attorney and fellow GOP gubernatorial hopeful Bill McSwain a “coward.”

“He encouraged me to keep fighting, and that’s what I’m going to do — keep fighting for the people of Pennsylvania,” Corman said.

The back-and-forth developments created a sense of whiplash in the race just over a month before the primary, and left a sprawling field still standing — and still jockeying for Trump’s support. And they showcased Trump’s lasting influence on Republican candidates for elected office.

Corman played golf with Trump at his West Palm Beach club in February. “Having played golf for several hours, the president told me how much he enjoyed Jake’s company and how much he enjoyed just learning more about what he’s done in Pennsylvania over a number of years,” former Trump aide Kellyanne Conway, a Corman adviser, told reporters last month.

» READ MORE: Several staffers have left Republican Jake Corman’s campaign for Pa. governor

Corman’s withdrawal still would have left eight Republican candidates vying for the party’s nomination, including McSwain, former U.S. Rep. Lou Barletta, state Sen. Doug Mastriano, and former Delaware County Councilman Dave White.

It remains to be seen how Corman’s aborted exit will affect his prospects in the race going forward.

Corman raised $3 million last year through his gubernatorial campaign and other political groups — the most of any candidate in the sprawling field. He was one of just three candidates, along with McSwain and White, who had enough money to air TV ads.

He has campaigned as the “conservative who stood up to” Gov. Tom Wolf and highlighted his legal challenges to the administration’s mask mandate in schools, successful opposition to the governor’s proposed new taxes, and his support for a partisan investigation of the 2020 election.

But Corman hasn’t gained much traction in the polls, and early staff departures seemed to reflect a campaign uncertain about its direction.

» READ MORE: The Pa. Senate leader resisted his pro-Trump wing for months. Now he wants a MAGA makeover.

First elected in 1998 to the Senate seat previously held by his father, Corman has been a fixture of the Republican establishment in Harrisburg for years. Long seen as a Senate institutionalist who believed in the virtues of bipartisanship and compromise, Corman tried to reinvent his political brand as he prepared a run for governor.

Last summer, he embraced calls for a “forensic investigation” of the 2020 election, pursuing a review that Trump and his allies had been urging for months. Mastriano had been leading that charge, threatening Philadelphia and other counties with subpoenas if they didn’t hand over election materials.

Corman ousted Mastriano from his leadership position and took control of the inquiry last summer.