Attendees at a rally hold up European flags. (Monika Skolimowska/Agence France-Presse via Getty Images)

The European Union, whose parliament meets here on the French border with Germany, has not exactly been popular in recent years.

Complaints about unelected bureaucrats, lack of transparency, compromised sovereignty, unrestricted migration and costly member obligations have all fueled Euroskepticism.

But it seems the E.U. has finally gotten its groove back.

Two new surveys find that over the past year, citizens of E.U. member countries have decided that maybe this whole European idea — the ambitious postwar project to promote continental peace and prosperity — isn’t so terrible after all.

The first survey, from Pew Research Center, polled people in 10 E.U. countries. In all but one, fond feelings for the union increased, most by a sudden huge amount. Here in France, favorability rose from 38 percent last year to 56 percent this spring (an increase of 18 points). Across the border in Germany, it went from 50 percent to 68 percent. Even in Brexiting Britain, positive sentiment for the E.U. climbed from 44 percent to 54 percent.

The other survey, from the European Commission’s Eurobarometer, also found an upswing in the share of European citizens who view the E.U. positively and have trust in it. Again, the upswing occurred in virtually every country.

What’s going on? How did the E.U. turn its reputation around?

To some extent, Europeans may simply be realizing that the grass isn’t actually greener on the other side — the other side being, in this case, life outside the European Union.

Britain’s upcoming exit has led to political chaos and economic uncertainty, not to mention sagging consumer confidence and departing jobs. Tens of thousands of jobs may leave London’s financial sector alone.

The same Pew survey found that majorities of nearly every country say Brexit will be bad for both the E.U. and Britain. Even a plurality of Brits believe Brexit will end badly for them. (Greece, which was threatening to “Grexit” the euro zone before departure portmanteaus were cool, is the only surveyed country in which a plurality believes Britain will be better off.)

Perhaps other E.U. members have watched Britain’s isolationist dysfunction and started to better appreciate the European project, even with its many flaws.

Not just coincidentally, in no country that Pew surveyed did a majority of respondents say they want to leave the European Union. This finding jibes with other recent polls

Nonetheless, even though they don’t want to leave, in nearly all of the countries at least half of respondents still want to hold a referendum to vote on whether to leave.

This may seem peculiar, given that Britain got such an unwelcome surprise when it held its own referendum. But this desire to hold a vote may reflect frustration with the lack of say in what happens in Strasbourg (and Brussels, Luxembourg and Frankfurt, where other major E.U. business gets done). A referendum could be viewed as a way to gain more leverage over E.U. officials, even if the vote is really a bluff.

“People think that voting will empower them,” says Luigi Zingales, a University of Chicago professor who has studied economic and public opinion trends in the E.U. “Most Europeans are happy with the idea of some form of European integration and the common market. They just want more voice in the process.”

Zingales also argues that a force bigger than Brexit may be more important in reviving the E.U.’s reputation: the fact that finally, a decade after the global financial crisis struck, so many European economies are actually improving.

Zingales notes that in the Pew data, only his home country of Italy hasn’t started feeling more warmly toward the E.U. Italy also happens to be the only surveyed country whose citizens are more pessimistic about their economy today than they were a year ago.

“When things go poorly, you blame everybody: your government, the E.U. government, probably also the United Nations,” he says. “When things go well, maybe you’re now sort of okay with everything.”

Lending credence to this theory is that trust in the E.U. government and trust in national governments have been rising in virtual lockstep, according to the Eurobarometer data.

In other words, a healing economy may lead to less scapegoating, more political stability. As things get better, people realize they overreacted, and their far-right, anti-immigrant, anti-internationalist, burn-it-all-down feelings subside.

If economics are indeed what’s driving the retreat from insularity in Europe, that bodes well for the United States, too. Our recovery, after all, is light-years ahead of most of Europe’s. Maybe our fever will break soon as well.