Maryland Gov. Larry Hogan on Tuesday won the most votes of any gubernatorial candidate in state history, a victory that made him only the second Republican executive in the state to win reelection.

Although Hogan lost to Democrat Ben Jealous among voters 29 and younger, according to a voter survey conducted by Fox News and the Associated Press, he was propelled to victory by older voters, political independents and Democrats who crossed party lines to support him, even as they ousted several down-ballot Republicans.

Before leaving with his wife, Yumi, on a week-long trip to Jamaica, Hogan told reporters he was able to withstand Maryland’s blue wave by being a governor “for all the people.” He won 66 percent of the independent state voters who do not lean toward either party and 31 percent of Democrats and Democratic-leaning independents, the voter survey showed.

“He cleaned up among Republicans, he bested Ben Jealous among independents and pulled away enough Democrats,” said Mileah Kromer, a political science professor at Baltimore’s Goucher College. “That’s the Hogan coalition.”

Jealous — whose campaign strategy hinged on increasing voter turnout — won 58 percent of first-time voters, 56 percent of voters ages 18 to 29 and 50 percent of voters 30 to 44.

But first-time voters constituted only 2 percent of the total turnout, and voters younger than 30 represented only 12 percent, according to the survey, which was conducted among 3,873 voters who reported voting or were considered likely to vote in the final days before the election and on Election Day.

“It’s not surprising,” Kromer said. “Jealous’s campaign was predicated on turning out unlikely voters. But older, habitual voters are the ones who reliably turn out in midterm elections.”

Hogan won voters 45 and older — a group that accounted for more than three-fifths of the midterm electorate — by a 25-point margin over Jealous. He bested Jealous among all education levels. And he won 63 percent of votes cast by men, compared with 36 percent for Jealous, and 50 percent of votes cast by women, compared with 48 percent for Jealous.

The governor also narrowly bested Jealous among union households, winning 51 percent of their votes compared with 49 percent for Jealous, the survey found. Public safety unions endorsed Hogan in the race, while other labor groups mostly backed Jealous.

Jealous and his running mate, Susan Turnbull, drew 917,982 votes, short of their goal of 1 million but more than the 884,400 that Hogan and running mate Boyd K. Rutherford won during Hogan’s upset victory over Democrat Anthony G. Brown four years ago.

Total turnout in Maryland surpassed 2.1 million, a record for a midterm election.

Hogan again lost the traditionally Democratic strongholds of Montgomery County, Prince George’s County and Baltimore, but he and Lt. Gov. Rutherford substantially increased the share of votes they won in those jurisdictions compared with 2014.

In Montgomery, where Hogan actively campaigned, he won 45 percent of the vote, up from 37 percent four years ago. In Prince George’s, he won 28 percent, up from 15 percent. In Baltimore, he won 32 percent of the vote, up from 22 percent. The only other jurisdiction Hogan lost in 2014, Charles County, went narrowly for the Republican this time.

Among African Americans, whom Maryland Democrats have long relied on, Hogan won 28 percent of the vote, the Fox-AP survey showed, compared with 71 percent for Jealous, a former president of the NAACP. Hogan’s support among black voters substantially increased during his first term, according to a Washington Post-University of Maryland survey last month.

Jealous and Hogan ran closer to even with Latino voters, with the Democrat earning 51 percent of their vote, compared with 48 percent for Hogan, according to the voter survey. Latinos in Maryland make up 10 percent of the state’s population but constituted only 4 percent of the total turnout, according to the survey.

Kromer said part of Hogan’s success with traditionally Democratic voters was because of his multimillion-dollar war chest, which allowed him to flood the airwaves with ads drawing contrasts between him and President Trump — who is deeply unpopular among Maryland Democrats.

Down-ballot Republicans running with less money did not have the same opportunity.

Michael Youngblood, a Prince George’s Democrat, said he was willing to cross party lines to vote for Hogan because the governor “didn’t go lockstep with Trump.”

“It seems very rare,” said Youngblood, 66, who voted on Tuesday at Reid Temple AME Baptist Church in Glenn Dale. “It makes me feel that he is not afraid of the establishment.”

Health care was the subject cited most frequently by Marylanders as the “most important issue facing our country.” Among the 28 percent of residents who cited it as the top issue, 59 percent voted for Jealous, who campaigned on Medicare-for-all. Forty percent chose Hogan. Those who think their families are “falling behind” financially went for Jealous, with 57 percent voting for the Democratic nominee and 41 percent for Hogan.

In bellwether Baltimore County, Rob Wanner, a political independent, voted for Hogan because “things are going well, and the state government is operating effectively,” he said.

“He’s my half-in, half-out man — he’s not afraid to compromise,” said Wanner, 64, who sported a T-shirt that said, “Clowns to the left, jokers to the right, here I am stuck in the middle.”

Voters who wanted to express opposition to Trump supported Jealous by a 2-to-1 margin, the survey shows. Similarly, among voters who said they had a “very unfavorable” opinion of Trump, 35 percent voted for Hogan, while 64 percent opted for Jealous. Among those who had a “somewhat unfavorable” opinion of Trump, 73 percent voted for Hogan, and 27 percent voted for Jealous.

At the same time, Maryland voters who like the president overwhelmingly like Hogan, even though the governor has frequently distanced himself from Trump and sometimes criticized him.

Hogan won 95 percent of Marylanders who have a “somewhat favorable” view of Trump and 93 percent of those who have a “very favorable” opinion of the president, the survey showed.

Republican Gilbert Potter of Parkville, Md., said Tuesday that he thinks Hogan has struck the right balance in distancing himself from Trump but not alienating Republican voters. Potter, who said he supports Trump’s agenda even though he sometimes questions some of the president’s actions, said Hogan sometimes “overdoes it” in criticizing the president.

“But that’s what he has to do to win — it’s a very blue state,” he said.

In his victory speech Tuesday in Annapolis, Hogan specifically thanked the Democrats and independents who supported him, telling them, “Let me assure you that I will continue to be a governor for all Marylanders.”

Lynh Bui and Scott Clement contributed to this report.

Read more: