Protesters demonstrated at the White House and in front of Trump International Hotel on Nov. 9 as they tried to come to grips with the election of President-elect Donald Trump. (WUSA 9)

If you lived in a swamp, and the newly elected president pledged to “drain” your residence, how would you react? That was the challenge facing the nation’s capital and its suburbs on Wednesday.

The anti-Washington focus of President-elect Donald Trump was stirring anxiety among local elected officials and a population heavy with agency workers. Many worried about possible cuts in federal jobs and contracts, deportation of undocumented immigrants and rollback of environmental protections.

There was cautious hope among some that the local economy could benefit from Trump’s calls for more investment in the military and infrastructure such as roads and transit — if he is able to persuade the GOP-dominated Congress to spend the money.

But there was also concern that Trump would continue to spout the mean-spirited rhetoric that characterized his campaign and keep condemning the federal government as corrupt and ineffective even as he took up its reins.

“I’m afraid it will change the city, just because of the Trump supporters who may come here, and who he will hire and bring,” said Katie McDonnell, a D.C. teacher. “I am a little worried.”

The chilly reception that may greet Trump in parts of the Washington region contrasts with the warm relationship that President Obama and his family have enjoyed here. Obama brought a youthful energy to the city, and his administration overlapped with a population boom that has transformed the District into something of a hip metropolis.

D.C. Mayor Muriel E. Bowser (D), who is a big fan of the current president, has described some of Trump’s more incendiary remarks as “idiotic.” Trump lost to Democrat Hillary Clinton by huge margins in both Washington and its suburbs, and the region did not have a single senator or member of Congress supporting him by Election Day.

Bowser said she told her staff to keep their heads up Wednesday after Trump’s win, as calls rolled into Bowser’s office from anxious constituents.

“Let me be clear, 93 percent of the people in Washington, D.C., that I represent are in that category of people who did not support him,” Bowser said. “There is some repairing of relationships that has to be done if he’s going to win the support of the people of the District of Columbia.”

But Bowser and others said they were encouraged by the comparatively moderate and conciliatory tone of Trump’s victory speech early Wednesday.

“To the extent that he said he wants to be a president for all of us, that’s a good sign,” said Rep. Don Beyer (D-Va.), who easily won reelection Tuesday.

There were more than a few people, including a union leader, who applauded the Republican’s focus on boosting jobs on U.S. soil. But there was worry as well.

“This is somebody who legitimized racism, sexism and homophobia,” said Rushern L. Baker III (D), county executive of Prince George’s, where Clinton won nearly 90 percent of the vote.

Beyer, who has been in Congress nearly two years, said it was “terrifying to read . . . about what [Trump] wants do about policies, including rolling back the Affordable Care Act. We have so many people in Northern Virginia who are dependent on it.”

Rafi Ahmed, who oversees government affairs for the Muslim Association of Virginia, predicted a deeper sense of distrust among Muslims under a Trump administration, especially since Trump has called for a temporary ban on Muslim immigrants.

“There is definitely fear and there is definitely heartbreak,” Ahmed said.

But Prince William Board of County Supervisors Chairman Corey Stewart, a strong Trump supporter, said Muslims need not worry as long as they are in the country legally.

“It’s pretty clear what he will try to do, which is to provide extra vetting of immigrants coming from areas that have a history of terrorist activity,” Stewart said.

In the Washington region, as in the rest of the nation, a common theme in people’s reaction to Trump’s victory was simple uncertainty. His many policy shifts and differences with Republican orthodoxy have left people unsure what to expect.

“I think he’s more independent than Republican,” said Jim Corcoran, president of the Northern Virginia Chamber of Commerce. “He won’t be beholden to the current Republican leadership.”

Corcoran expressed hope that Trump would boost spending on the armed forces and transportation. “He believes in a strong military, and that helps our region in all three jurisdictions, particularly in Virginia,” Corcoran said.

But he was wary of Trump’s criticisms of free trade agreements, saying, “Our local economy, being a high-tech economy, needs to improve our exports.”

A top local union leader took a contrasting position, saying organized labor would like to see Trump make changes on trade.

“The American labor movement has been leading the battle against unfair trade agreements for decades,” said Carlos Jimenez, executive director of the Metropolitan Washington Council AFL-CIO. “We’re interested in looking at those with him.”

Michelle James, a 48-year-old Montgomery County resident who voted for Clinton, said she believes strongly in the power of the public sector — after all, she works for the county transportation department.

“When government works,” James said, “it works well.”

Even so, she said, she relates to Trump supporters’ calls to shake things up in Washington. She voted Tuesday for term limits on county public officials because she’s tired of some politicians staying in office for years on end.

“We need a change,” James said. “The problem is what kind of change are we going to get? Do we change subtly or in an aggressive manner? . . . It’s the not knowing what’s going to happen that’s making us squirm right now.”

Animesh Gupta, a software developer in Fairfax and father of two, said he hoped Trump would follow through on pledges to provide tax relief for child care. “Having some relief for that will allow people to buy houses and raise families. . . . More like the old America,” he said.

Rep. Gerald E. Connolly (D-Va.) was skeptical that Trump’s plan for infrastructure investment would come to pass with a Republican Congress. He was especially doubtful that spending would be directed at the Washington region, such as for Metro or the crumbling Memorial Bridge.

“We haven’t had a lot of excitement on the Republican side of the aisle if that involves spending and adding to the deficit,” Connolly said. “Where are you going to get the money? They’re not willing to raise taxes.”

Like Bowser, Connolly also pointed to the lack of support for Trump in the region’s electorate. “I think he’s coming into hostile territory, from a political point of view,” he said.

That point was echoed in comments from the pulpit of Washington National Cathedral in Washington at a midday “Post-Election Reconciliation Service.”

Amid the gleaming marble of the iconic church, the Right Rev. Mariann Edgar Budde addressed people who were feeling unmoored by the election results.

Invoking the Jews’ captivity in Babylon, she said, “You are going to be in exile for a long time. . . . Learn to adapt and adjust.”

Aaron C. Davis, Peter Jamison, Antonio Olivo, Martine Powers, Patricia Sullivan, Perry Stein, Michael Chandler, Arelis Hernandez, Paul Schwartzman and Josh Hicks contributed to this report.