“This may not affect people on the top of our country, but it can only mean bad news for us merchants and lower, working-class people in Mexico,” said Claudia Rivera, a street vendor who owns a food cart in Mexico City.

Outside of concerns about the election, violence has been soaring to levels not seen since the start of the drug war a decade ago. And corruption and a loss of faith in the political leadership had already plunged the nation into a state of gloom. Now, the loss for many is external, too.

“A lot of people see the U.S. as a beacon of freedom, as something to aspire to,” said Mr. Pardinas, who works on legislation and economic competitiveness. “But what happens when you lose a role model, the role model of a nation? Now all of us who admired the U.S. are having second thoughts.”

For most Mexicans, the American election has been a grim exercise in self-perception. Mr. Trump, a candidate who called Mexican immigrants “rapists” and criminals, vowing to deport millions and build a wall to keep others out, has stoked long-held insecurities in Mexico over sovereignty and respect from its northern neighbor. And his victory was seen by some as validating the perception that Americans, or at least half of them, see Mexico through a knot of stereotypes.

Never mind that Mexico’s rich culture and cuisine, its art and film, are having a global moment, Mexicans say. Or that a wall between the two countries these days might actually keep more Mexicans in the United States than out, given the recent research showing more Mexicans are returning home than leaving to seek opportunity in America.