Corey Stewart, then the Virginia chairman of Donald Trump’s campaign, talks with guests before a Veterans for Trump dinner in Woodbridge, Va., in August. (Toni L. Sandys/The Washington Post)

Corey Stewart had just been canned. And in a year of outsider politics, maybe that wasn’t such a bad thing.

Right after he was fired as Donald Trump’s Virginia campaign co-chairman, Stewart trumpeted his ouster in a news release — one issued on letterhead for his 2017 bid for governor.

Stewart was one of Trump’s earliest and most vocal supporters in a key presidential swing state, one that appears likely to go Democrat Hillary Clinton’s way. He also is one of at least four Republicans running for governor next year.

Stewart’s association with — and dismissal from — Team Trump will probably shape his prospects in 2017, political strategists say. But there is little agreement on whether it will help or hurt.

Stewart embraced the brash businessman with more enthusiasm than any of his gubernatorial rivals, some of whom only grudgingly got on board after Trump locked up the nomination. That close association could damage Stewart in a state on track to reject Trump.

Yet his firing — over something Stewart cast as a gutsy stand against “establishment pukes” at the Republican National Committee who he said were undermining Trump — could endear him to anti-establishment Republicans and tea party types in the GOP primary. If nothing else, his ejection has insulated Stewart from any Election Day wreckage. Still a Trump supporter but now lacking any campaign role, he can say that a Trump defeat could have been avoided if party leaders had heeded his calls for more staffers and money.

Stewart was warned that his actions against the RNC would cost him the campaign job, and he acted anyway. But he insists that he did so without regard for his gubernatorial hopes. As chairman of the Prince William Board of County Supervisors, he has faced controversy many times, first drawing national attention a decade ago with a crackdown on illegal immigrants that lines up neatly with Trump’s hard-line approach.

“I didn’t calculate it that way,” he said in an interview Friday. “Take a look at my entire political career. I’ve said things that nobody else would say and I’ve done things nobody else would do. It doesn’t always benefit me. But I can’t be anything else.”

Some Trump campaign officials have accused Stewart of trying to leverage his ouster for 2017, particularly with his claim that his firing had been engineered by a rival for the nomination. His campaign has already turned his termination into a fundraising pitch.

“As one of the first supporters of Donald Trump, Chairman Corey Stewart was FIRED by the Trump campaign for being loyal and supportive of his candidate,” says a fundraising appeal emailed to supporters. “Virginia needs someone who will stand up to the establishment and stand up for what he feels is right.”

The Trump campaign dismissed Stewart on Monday after he took part in a protest in front of committee headquarters in the District. It had been aimed at warning the national party against abandoning Trump after a damaging recording of Trump bragging about groping women.

Stewart said that shortly before the rally began, Trump deputy campaign manager David Bossie texted him a warning: Stop the rally or face “dire consequences.” Stewart went ahead with the demonstration.

“I knew it might result in my being removed as Chairman,” Stewart soon wrote to supporters on his 2017 campaign letterhead. “I chose to go forward with it because this country is too important to stand idly by as our own party throws the election to Hillary Clinton.”

In interviews later with The Washington Post and other news outlets, Stewart blamed his firing on GOP strategist Ed Gillespie, a Republican gubernatorial hopeful who narrowly lost a 2014 Senate race to Sen. Mark R. Warner (D-Va.).

“I was fired for personal reasons by Dave Bossie,” Stewart said on MSNBC. “He’s the deputy campaign manager. He’s good friends with Ed Gillespie, who I’m running against for governor of Virginia next year.”

Chris Leavitt, executive director of Gillespie’s political action committee, said Gillespie had nothing to do with Stewart’s firing.

“Contrary to Corey’s latest conspiracy theory, he alone is responsible for his firing,” Leavitt said. “That’s a fact he himself made abundantly clear at the time and the Trump campaign has repeatedly said.”

John Fredericks, a conservative radio host who became Trump’s acting Virginia chairman after Stewart’s exit, called allegations of Gillespie’s involvement “completely false and delusional.”

“As everybody knows, I’m not a Gillespie enthusiast,” said Fredericks, who crossed party lines to endorse Warner over Gillespie in 2014. “But I’m a big fan of the truth.”

Stewart had vigorously defended Trump amid a string of controversies, including Trump’s criticism of the “Mexican” judge presiding over a fraud case against the now-defunct Trump University. The federal judge, Gonzalo Curiel, was born in Indiana to parents who immigrated from Mexico.

Yet Stewart has not always supported Trump in ways that the campaign found helpful. In July, Trump’s campaign disavowed comments Stewart made on Facebook that placed responsibility for the killing of police officers in Dallas on Clinton and Virginia Lt. Gov. Ralph Northam, the lone Democrat running for governor in 2017.

“Corey said certain things and did things that were counter to the Trump message, that were designed, it appeared, to further burnish his credentials with tea party voters in Virginia and the hardest-core Trump supporters — at the expense of gaining votes in Virginia for the candidate on Nov. 8,” Fredericks said.

Stewart was the only prominent Virginia Republican to defend Trump after the recent release of a 2005 recording of Trump talking about using his celebrity status to force himself on women. He said Trump had “acted like a frat boy, as a lot of guys do.”

“The Trump campaign asked, when this [video] went down, that all the surrogates take a breath for 24 hours to figure out how to respond,” Fredericks said. “Corey was making statements Friday night. . . . Sometimes he was on the Trump team and sometimes he was on the ‘Corey Stewart for governor’ team.”

Yet Shaun Kenney, the state GOP’s former executive director, said the episode could play well for Stewart among grass-roots Republicans frustrated with ­finger-in-the-wind politicians.

“Stewart appears to be a rod of iron in a sea of spaghetti noodles masquerading as backbone,” he wrote on the conservative blog Bearing Drift. “In an odd twist, Stewart gained from this incident — lost a title; gained some trust.”