“We showed that you can improve public finances and improve living conditions for the public at the same time,” João Galamba, Costa’s secretary of state for energy, told me. “And we showed the Portuguese people that being in the European Union doesn’t only have to mean cuts.”

Politicians and political scientists here offer a set of overlapping explanations as to why the small Iberian country seems to be Europe’s least fertile ground for right-wing extremism. For one, the country has bad memories of a right-wing dictatorship that only fell in the 1974 Carnation Revolution. But there are contemporary reasons, too: Portugal’s left-wing parties have been able to maintain close ties to the country’s organized working class, a voting bloc that elsewhere in Europe has, at least in part, voted with the far right. “In this sense, the Communist Party acts as kind of a shield” against a far-right insurgence, said Pedro Magalhães, a political scientist at the University of Lisbon.

And Portugal has received a smaller influx of foreigners than have neighboring countries in recent years, meaning the right could not use immigration as a campaign issue. Indeed, Portugal is actively seeking more immigrants, Galamba told me, as an antidote to a demographic deficit caused by emigration and an aging population. Costa’s predecessor as prime minister, Pedro Passos Coelho, actually told young Portuguese people to consider leaving to look for work elsewhere, sapping confidence in the country.

Read: Democracy is under attack. Will Europe fight back?

“Things are not as bad as they used to be, so I decided to give the Socialists four more years,” Gabriela Cesar, a 58-year-old domestic worker, said after she cast her ballot yesterday in downtown Lisbon. She told me she previously had voted center right, and didn’t agree with the Communists or the Left Bloc on much. “But this contraption has gotten a few things done. So let’s see if they can get this country out of the ditch.”

If Portugal had the same discourse around race that the United States does, Costa would be celebrated as the country’s first prime minister of color—his father’s family is from Goa, the former Portuguese colony in western India. But his skin color was barely an issue in his two election victories, as his supporters instead stressed his practical skills as a negotiator over his identity or grand ideological vision.

Those negotiations with the left were indeed a fundamental part of Portugal’s recovery: Costa did not form a formal coalition with the Communists and Left Bloc, but they agreed to support his minority government on key votes, such as budgets, in exchange for specific agreements on wages, pensions, and small moves to reenergize the welfare state. But the Portuguese leader also benefited from favorable economic conditions, said Susana Peralta, an economist at the Nova School of Business and Economics in Lisbon. In the years since 2015, the broader European economy has grown at a decent clip, and the European Central Bank’s policy of buying up enormous quantities of government bonds to bolster the regional economic recovery has kept borrowing costs low. At the same time, the economic crisis wiped out some of the country’s poorly performing businesses, making the country more competitive. And, if anything, the inclusion of leftists in the contraption may have actually helped the economy overall, since the coalition’s anti-austerity stance put money back in regular people’s pockets and contributed to a virtuous cycle of spending. “The Socialists already planned to raise incomes,” Peralta told me, “but the left parties made them carry that out more quickly than planned.”