CREDIT: AP Photo/Kirsty Wigglesworth. Britain’s new Prime Minister Theresa May

On Wednesday, Theresa May will become the next prime minister of the UK, taking over after former Prime Minister David Cameron resigned in the wake of his country’s vote to exit the European Union. She will be the country’s second female prime minister in all of its history.

That this historic turn of events comes at a time of high political turmoil, however, is likely no coincidence.

The UK’s vote to leave the European Union — which has come to be known as its “Brexit” — immediately roiled financial markets and has continued to leave a big imprint on the British economy. Businesses are saying that the decision to leave the union is making them tighten their purse strings and consider cutting jobs. Credit Suisse is already predicting that the country will fall into a recession next year thanks to the economic impact of the exit.

That means that the incoming prime minister will have a huge mess to clean up with big risks if he or she makes the wrong decisions. May has declared that “Brexit means Brexit,” meaning that she won’t find a way to get out of the voters’ decision to leave, but she has promised that she will “make a success of it.”

Women set up to fail

The fact that it’s a woman coming in to clean up that mess follows a prominent paradigm for women who rise to roles of power and influence. They are most likely to be brought into those roles during times of trouble, handed a more difficult job than leading when things are going well. The phenomenon has been called the “glass cliff” by researchers who study it.

And they’ve found it happens over and over again. It’s a pattern repeated often in the business world. A number of studies have found that women and people of color are much more likely to be hired for executive jobs or put on boards at times of bad financial performance — just after a loss in earnings or as stock prices are declining, for example — than white men. That means women and people of color are given the more difficult task of righting a sinking ship and are at greater risk of failure. And in fact female CEOs are more likely than male ones to be forced out of their jobs. Once they’re gone, white men are often brought back in as a “savior.”

There have been a number of recent examples: Mary Barra became the first female CEO of General Motors just as its air bag failures came to light. Marissa Mayer is on the verge of being ousted over her inability to turn Yahoo around. The first female CEOs at Xerox, Sunoco, and Hewlett-Packard took over as stock prices and earnings were falling significantly.

An uphill climb to Parliament

The same trend has now been uncovered in politics.

The researchers who first discovered the glass cliff in business looked at British politics and found that women were more likely than men to be chosen to run for political seats that are hard to win. That could potentially be because of differences in candidates’ experience and capabilities, but when they ran an experiment where they controlled for those variables, they found that study subjects were more likely to choose a woman to run for a hard to win seat where the party had lost the previous elections. The same phenomena held true for people of color.

Brexit is not a mess that May or the other women in charge caused themselves. May was, in fact, the only leadership candidate in her party who favored remaining in the EU. David Cameron set the date for a vote; the Leave campaign was fueled by high-profile supporters Boris Johnson, Michael Gove, and Nigel Farage.

But it will now be left to women to clean it up. Beyond May herself, her ascendancy to the role of prime minister will likely more women get put in key cabinet positions. She is also governing alongside two other women in prominent roles in her country: Scotland’s First Minister Nicola Sturgeon and Ireland’s First Minister Arlene Foster.

And the glass cliff won’t be the only sexism May will have to confront in her new role, either. A prominent former Conservative politician was caught calling her “a bloody difficult woman.” A columnist has called her “dull as porridge” and “quite plain.”