Representative Lauren Boebert (R., Colo.) won a crowded Republican primary on Tuesday after she swapped congressional districts to avoid losing her place in the House.

Endorsed by former president Donald Trump, Boebert defeated Colorado GOP primary contenders Deborah Flora, Jerry Sonnenberg, Mike Lynch, Richard Holtorf, and Peter Yu to fill former Representative Ken Buck’s seat. Deciding not to seek reelection, Buck left Congress earlier this year. Boebert led by a wide margin, as NBC News and the Associated Press projected her the winner of the race.

The incumbent congresswoman is all but guaranteed to win the general election in November, considering Colorado’s fourth congressional district is solidly red.

Elected in 2020, Boebert represents the third congressional district in western and southern Colorado. In her current district, she faced a strong Democratic threat who could have unseated her if she stayed. To improve her chances of remaining in the House, she relocated to a conservative area in northern Colorado.

Boebert said she made the change because Hollywood stars Ryan Reynolds and Barbra Streisand were donating to her Democratic opponent, Adam Frisch. She accused the actors of “trying to buy” the state’s third congressional district. The Colorado Republican narrowly won against Frisch in the 2022 midterms.

“We cannot lose the third, and Colorado’s Fourth District is hungry for an unapologetic defender of freedom with a proven track record of standing strong for conservative principles,” Boebert said in December. “We have to protect our majority in the House, win the Senate, and win the presidency.”

Buck’s departure triggered a special election, which Republican candidate Greg Lopez won Tuesday night. A former mayor, Lopez will temporarily replace Buck and said he wouldn’t run for a full term.

Boebert decided not to run in the fourth district’s special election, as that would have required her to give up her current seat. That could have been a dangerous move, given that Republicans have a slim majority in the House.

In the GOP primary race for Boebert’s current seat, Republican front-runner Jeff Hurd defeated Ron Hanks on Tuesday night. Hanks was elevated in a $400,000 ad campaign by a Colorado Democratic PAC and Frisch, who viewed him as the weaker Republican opponent. Colorado Democrats also spent $100,000 targeting Hurd.

Over the past year, Boebert has faced unflattering headlines related to her personal life. In September, she was kicked out of a Denver theater for vaping, disturbing audience members, and groping her date during a performance of the Beetlejuice musical. Months before, she filed for divorce from her husband of 18 years.