How Trump has weighed in, or not, on 2017 elections Until Tuesday, the president mostly stayed away from Democratic wins.

 -- As Democrats celebrated sweeping victories in state and local races across the United States Tuesday, at least one Republican was immediately ready to evaluate what went wrong for the party on Election Day, a year after the GOP captured the White House and maintained control of both houses of Congress.

President Donald Trump, in the midst of a 13-day trip to Asia, was quick to weigh in Tuesday on Republican Ed Gillespie's defeat in the Virginia gubernatorial race as news organizations began to make projections that the race would go to Democrat Ralph Northam.

"Ed Gillespie worked hard but did not embrace me or what I stand for," Trump tweeted Tuesday night.

The president claimed a string of successes in special elections throughout the year, but has also been quiet in races in which it appeared that his influence could hurt the Republican candidate or Democrats were on a clear path to victory.

Here's a look at how Trump has weighed in on major races throughout 2017:

Virginia governor

In Virginia, Trump gave his full-throated support to Gillespie via Twitter, but spent no time on the campaign trail with the former Republican National Committee chairman to stump in-person. The president seemed to cite that in his tweet Tuesday in which he said Gillespie hadn’t "embraced" him

While Trump never campaigned for Gillespie, Vice President Mike Pence appeared on the candidate's behalf in October

New Jersey governor

Trump was publicly silent on the race, long viewed as Democrat Phil Murphy's to lose. The dismal approval ratings of Gov. Chris Christie, a Trump ally, made the election a difficult one for Republican Lt. Gov. Kim Guadagno. Murphy won Tuesday by a 13-percentage point margin with 99 percent of the state's precincts reporting.

Utah's 3rd Congressional District

Pushback against Trump in Utah in 2016 may have contributed to the president's decision not to weigh in on the race won Tuesday by Republican Provo Mayor John Curtis. Though Trump won a plurality of the vote in the state last year, he fell more than 25 percentage points below the total received by Republican candidate Mitt Romney in 2013.

Alabama Senate primary

The president backed incumbent Sen. Luther Strange from the start, after then-Alabama Gov. Robert Bentley appointed Strange to fill Jeff Sessions' seat when Sessions accepted the position of U.S. attorney general. When Strange finished in second in the first round of voting, but forced a runoff, Trump traveled to Alabama to campaign in person, but hedged that he would be willing to support challenger Roy Moore if Strange were unsuccessful.

"I might have made a mistake, I’ll be honest," Trump said at a September event for Strange.

He further made a prediction about the media's reaction to a possible Strange loss.

"If Luther doesn't win, they're not going to say we picked up 25 points in a very short period of time. They're going to say, 'Donald Trump, the president of the United States, was unable to pull his candidate across the line. It is a terrible, terrible moment for Trump. This is total embarrassment.'"

Moore ultimately defeated strange 54.6-45.4 percent and Trump focused his response on the progress Strange made because of his influence.

Georgia's 6th Congressional District

In April, Republicans feared losing the suburban Atlanta district formerly held by then-Health and Human Services Secretary Tom Price, but GOP candidate Karen Handel managed to force a runoff against Democrat Jon Ossoff, the first-place finisher in the original round of voting.

At first, with 11 Republicans in the field, Trump avoided endorsing a particular candidate and admitted that the party was playing for a runoff. After Handel advanced, he engaged in an all-out onslaught against Ossoff and visited Georgia for a Handel fundraiser.

Ossoff managed to cut into the typical Republican margin of victory in the district, but Handel won the seat 51.9-48.1 percent.

South Carolina's 5th Congressional District

With Republican Ralph Norman the strong favorite to replace Office of Management and Budget Director Mick Mulvaney in South Carolina, Trump tweeted only once to encourage 5th district residents to vote. Democrat Archie Parnell performed better than expected, but Norman won the seat 51.1-47.9 percent.

California's 34th Congressional District

Trump stayed away from the race to replace California Attorney General Xavier Becerra in the Los Angeles district that has elected Democrats since 1983. The top Republican, William Morrison, finished in eighth place with less than 4 percent in the first round of voting. Two Democrats moved on to a runoff where Jimmy Gomez was elected to the seat.

Montana's at-large congressional district

In Montana, where the GOP held the state's single congressional seat for the past two decades, Trump had little to say until after the election. Many campaign observers believed that Democrat Rob Quist stood a decent chance of flipping the seat formerly held by Interior Secretary Ryan Zinke, particularly after Republican Greg Gianforte was charged with assaulting a reporter the day before the election.

While Quist was able to improve upon Democrats' performance the preceding November, Gianforte won the state by slightly more than 6 percentage points. Trump's tweet after the election did not name Gianforte -- who would later plead guilty to the assault charge -- but rather attacked the media for its coverage of the race.

Kansas' 4th Congressional District

Republican Ron Estes won the race in Kansas' deep-red 4th Congressional District in April. He received one tweet from Trump on the day of voting, with the president calling the candidate a "wonderful guy." Democrat James Thompson came closer to winning than any Democrat in over 15 years, but still lost by over 6 percentage points.