In a resounding victory for advocates of immigration reform and voting rights, Democrat Laura Kelly defeated Kris Kobach in the race to be the next governor of Kansas Tuesday night.

NBC News and CNN called the race for Kelly shortly after 10 p.m. ET.

The popular state senator defeated the hardline conservative secretary of state and Independent Greg Orman in a nail-biter of a three-way race.

The Sunflower State’s gubernatorial contest was one of the nation’s most closely watched. Kelly’s victory shatters trifecta Republican control, giving her a key veto over district maps drawn by the GOP-controlled state legislature post-2020. That power will allow her to block Republicans from locking in GOP control through the once-a-decade redistricting process.

Kelly won by drawing support from a coalition of Democrats and moderate Republicans put off by Kobach’s hardline policy positions. Over two dozen Republican lawmakers threw their support behind the Democratic nominee, urging Kansans to vote their conscience.

Local political experts predicted that Orman could be a spoiler, with the socially liberal, pro-business independent peeling some votes away from the Democrat and tipping the race to Kobach.

But Kelly managed to make the race a referendum on deeply unpopular former Gov. Sam Brownback, whose sweeping tax cuts devastated the state’s education budget. Kelly told Kansas voters that a Kobach administration would mean more of the same.

The Democratic nominee also reminded voters of Kobach’s history of pushing legislation that made it easier for law enforcement to detain suspected undocumented immigrants and harder for Kansans to vote.

Just this summer, Kobach’s “show me your papers” law requiring voters to show proof of citizenship was struck down as unconstitutional by a federal judge. Kobach was even ordered to take legal ed classes for defying the judge’s instructions and violating rules surrounding discovery.

Kobach was intimately involved with some of the Trump administration’s most controversial policy efforts. He expressed support for a registry of Muslim Americans during the 2016 campaign, and subsequently helped draft Trump’s proposal to ban immigrants from a handful of majority-Muslim countries.

Kobach was also the vice-chair of Trump’s now-disbanded commission on voter fraud—an issue experts say barely exists.

The Kansas governor’s mansion tends to alternate between Democratic and Republican control, and after two terms with Brownback implementing conservative policies in the state, Kansans have again elected a Democrat.