NEW YORK (Reuters) - The Democratic Party’s insurgent left wing and Republican U.S. President Donald Trump each claimed big victories on Tuesday, as voters in seven states selected the parties’ candidates for November’s midterm elections that will determine control of Congress.

U.S. Representative Joseph Crowley, a high-ranking Democrat seen as a possible future leader of the chamber, lost his re-election bid in a stunning upset that highlighted the ideological battles at play in this year’s midterm elections.

Crowley, a 10-term incumbent who was fourth in line in the House of Representatives’ Democratic leadership, was defeated by 28-year-old challenger Alexandria Ocasio-Cortez in a safely Democratic district in New York City.

Political analysts cast Ocasio-Cortez’s win as the biggest upset since House Majority Leader Eric Cantor, a Republican, lost in 2014 to a little-known right-wing professor, Dave Brat.

The outcome of the New York race added fuel to the battle between the Democratic Party’s establishment wing, led by longtime House Democratic leader Nancy Pelosi, and a more liberal faction inspired by Bernie Sanders’ presidential run in 2016. Ocasio-Cortez served as an organizer for Sanders’ campaign.

“This is yet another canary in the coal mine for both November and the years ahead,” said Joshua Henne, a Democratic strategist. “You can look back four years to around now when Eric Cantor was knocked off and what that meant for an ascendant wing on the right. This is a big deal.”

In a statement, Crowley said he would support Ocasio-Cortez in the general election.

“The Trump administration is a threat to everything we stand for here in Queens and the Bronx, and if we don’t win back the House this November, we will lose the nation we love,” Crowley said in a statement.

Meanwhile, two Republicans backed by U.S. President Donald Trump prevailed in their nominating contests Tuesday night, again underscoring his influence among the party’s voters.

Slideshow ( 4 images )

In South Carolina, Governor Henry McMaster beat businessman John Warren in a runoff election held a day after the incumbent campaigned alongside the president.

In a bitter matchup in New York City’s Staten Island borough, incumbent Dan Donovan easily held off the man he replaced in Congress, Michael Grimm, who resigned three years ago after pleading guilty to tax fraud.

“New York, and my many friends on Staten Island, have elected someone they have always been very proud of,” Trump said on Twitter late on Tuesday, congratulating Donovan.

Grimm, a bombastic former Federal Bureau of Investigation agent known for once threatening to toss a television reporter off a balcony, had cast himself as the true Trump supporter in what had become a nasty, insult-laden campaign. He said his conviction was due to a “witch hunt,” echoing Trump’s characterization of the investigation into his campaign’s possible ties to Russia.

The district is considered within reach for Democrats in November.

SEVEN STATES HOLD PRIMARIES

Voters in Colorado, Maryland, Mississippi, New York, Oklahoma, South Carolina and Utah picked candidates on Tuesday for the Nov. 6 midterm elections that will determine whether Republicans maintain control of both chambers of the U.S. Congress as well as numerous gubernatorial seats.

Democrats need to flip 23 of 435 seats to take over the House of Representatives, which would stymie much of Trump’s agenda while likely opening up new avenues of investigation into his administration. They would have to net two seats to take the Senate, but face longer odds there.

Slideshow ( 4 images )

In Maryland, Ben Jealous, former president of the National Association for the Advancement of Colored People, defeated Rushern Baker, a veteran politician, in what was seen as another win for liberal Democrats.

Jealous would be the state’s first black governor if he can beat popular incumbent Republican Larry Hogan in November.

In Colorado, an establishment-backed Democrat defeated a liberal insurgent to win the right to take on incumbent Republican Representative Mike Coffman, whose district favored Democrat Hillary Clinton over Trump in 2016.

Jason Crow, an Iraq war veteran backed by the national party, faced Levi Tillemann, who was endorsed by Our Revolution, a group born out of Sanders’ presidential bid. Tillemann earned attention this month with an anti-gun violence video in which he blasted himself in the face with pepper spray.

Democratic U.S. Representative Jared Polis won his party’s nomination for governor in Colorado and could become the first openly gay man to be elected governor of a U.S. state.

He will face Republican Walker Stapleton, the state’s treasurer, in November.

In Utah, former Republican presidential nominee Mitt Romney easily won his party’s nod for Senate. He will be heavily favored in November in the conservative state.