President Donald Trump demonstrated his continued grip on the Republican Party this week as candidates he endorsed ousted nearly every Indiana state senator who had defied him on a key redistricting vote, a purge that underscored his willingness to exact revenge on dissenters even as intraparty conflict drains resources ahead of November’s midterm elections.

The Associated Press reported that five of the seven Indiana lawmakers Trump had targeted lost their seats, one won, and one race was too close to call. Trump allies poured more than $8.3 million into races that normally attract little spending, a signal of how heavily the president invested in punishing those who opposed his preferred congressional map.

Rick Tyler, a Republican strategist critical of Trump, said, “Every dollar going toward keeping seats we already have, and not winning ones we don’t, really matters.”

State Sen. Linda Rogers, one of the defeated lawmakers, said the primary results would reverberate far beyond Indiana. “If someone is going to ask you to take a tough vote, you may think twice about your conscience and what’s best for your community and instead what’s best for you and your career,” she said.

Indiana Gov. Mike Braun, who sided with Trump, called it a “historic night” and thanked voters who “stood with me and President Trump to nominate some great America First conservatives.”

The redistricting fight began last year when Trump pushed Indiana’s Republican-controlled legislature to redraw congressional boundaries to give the party an extra edge. After the state Senate rejected the plan in December, Trump vowed to challenge the defiant lawmakers. Andy Zay, a state senator who had voted for redistricting, resigned in January to become chair of a state utility commission. He said Trump’s influence and the heavy spending made it difficult for incumbents to survive. “Trump matters and money matters,” Zay said.

The Indiana purge is part of a broader Trump effort to enforce loyalty ahead of midterm contests, and his allies celebrated the results as a warning. “Redistrict ASAP for the November election or you face a real risk of losing your seat. No excuses,” conservative activist Robby Starbuck wrote on social media.

The redistricting drive was supercharged last week when the U.S. Supreme Court gutted a provision of the Voting Rights Act that influenced how political lines are drawn in areas with large nonwhite populations. The Associated Press reported that Alabama and Tennessee have already begun special sessions that could limit Black voters’ strength in Democratic-leaning districts, and some of Trump’s allies in South Carolina want to follow suit.

Trump is now focused on ousting two higher-profile GOP dissenters in Congress. He has endorsed Republican challengers to Sen. Bill Cassidy of Louisiana and Rep. Thomas Massie of Kentucky. In Louisiana, more than $28 million has been spent on attack ads in the three-way primary that includes state Treasurer John Fleming. Cassidy’s campaign manager, Katie Larkin, said the senator “is running like he’s 10 points down and is pounding the pavement every day.”

Massie has frustrated Trump by pressing for the release of the Jeffrey Epstein case files, challenging the president’s military action in Iran without congressional approval, and voting against the party’s sweeping tax-and-budget bill last year. In a recent interview, Massie defended his record. “I vote with the Republican Party and this president 90% of the time, and the 10% of the time that I’m not voting with the party or the president, I’m keeping the promises that the president and I campaigned on,” he told Kentucky’s PBS affiliate.

Former House Speaker Kevin McCarthy noted that Trump has targeted Massie before, unsuccessfully. “Thomas Massie has been very popular in his district,” McCarthy said on “Fox & Friends.” Still, he warned that running without Trump’s backing is “not an ideal situation for any Republican.”

Marc Short, a former aide to former Vice President Mike Pence, questioned whether Trump’s heavy involvement in intra-party primaries will pay off in November. “There’ve been questions before, when he engages in these inner-party contests, will they work out as well when we get to the general election?” Short said.

Rogers, who faced nearly $670,000 in television ads funded by political action committees tied to Braun and U.S. Sen. Jim Banks, expressed no regret over her vote. “It would have been easy for me to hit that ‘yes’ button,” she said. “To hear the number of people who asked me not to, then the number of people who thanked me, would mean I wasn’t representing them.”