To prevent her government from collapsing, German Chancellor Angela Merkel has just agreed on a compromise that will make it harder for migrants to enter the country.

It’s a particularly strange move for Merkel, who has been a strong advocate for open borders since the onset of the European migrant crisis in 2015. But given that Merkel’s leadership was very literally at stake, she agreed to tighten the German border to save her fragile coalition.

Her main opposition comes from German Interior Minister Horst Seehofer, who leads the conservative Christian Social Union (CSU) party. Seehofer wants to turn away some migrants from the German border, including those who have already applied for asylum in other European Union countries. His support is crucial for Merkel to stay in power, as the CSU is one of her main coalition partners.

Back in February, Germany’s two largest political parties — the center-left Social Democratic Party (SPD) along with the combined center-right Christian Democratic Union (CDU) and the CSU — renewed a coalition governing agreement with Merkel at the helm. The CSU governs the wealthy German state of Bavaria, while the CDU, which is Merkel’s party, governs the country’s other 15 states.

The coalition ensures that Merkel has a majority in Parliament, but she needs the support of all three parties to stay in power. This could change, though, with the upcoming Bavarian elections in October. The rival Alternative for Germany (AfD) party, which is a far-right, anti-immigration group, is gaining support and could threaten the coalition. Some speculate that the rise of the AfD may be the reason why Seehofer wants to take a hard stance on migration.

“What’s happening now has nothing to do with content,” Nils Diederich, a political science professor at the Free University Berlin, told the Washington Post. “It’s solely aimed at the upcoming Bavarian state elections.”

If approved, the migration proposal will establish border camps, or “transit centers,” where incoming migrants will be screened along the Germany-Austria border. Migrants who have already applied for asylum in another EU country will be sent back to their relevant countries if those countries consent. If not, they will be sent to Austria, “on the basis of an agreement.”

“The security of our country begins on our borders,” Merkel told reporters after meeting with coalition members.

Merkel is waiting for the approval of the SPD, the third party in her coalition. But they’re reportedly skeptical of the agreement, and rejected a similar plan several years ago. The party has also typically been supportive of open borders in the past. So now the plan is largely up in the air, with no clear resolution if the SPD doesn’t approve.

“We have many open questions,” SPD leader Andrea Nahles said on Tuesday. Nahles added that the vague plan lacked the consent of or bilateral deals with other EU countries, such as Italy and Austria. “That’s why I consider the deal for now as an uncovered cheque.”

Germany has seen a recent anti-immigration backlash in part because conservative groups have claimed that crime levels have risen, but they’re actually at the lowest levels since 1992.

In 2015, Merkel enacted an open-door policy to take in refugees fleeing war from Syria, Iraq, and Afghanistan, reportedly taking in more than 1.4 million people; now, about 10,000 immigrants flow in each month.

Right now, all asylum seekers are allowed to enter the country while they wait for their cases to be reviewed, but the agreement will challenge this long-instituted policy.

The EU doesn’t think migration should be their problem anymore

Merkel’s new curb on migration comes in the middle of a massive immigration debate in Europe. Other countries including Italy and Austria have also been outspoken critics of Merkel’s open-door policies.

Last month, EU leaders met to discuss migration policies in Brussels, agreeing on a compromise that outlines new border restrictions that largely attempt to keep migrants in Africa and the Middle East.

Although the new deal reached at the two-day EU summit didn’t include many concrete plans, it signals that the EU is trying to contain would-be migrants before they leave their home countries. Among other things, the EU is pushing to set up centers in Africa where migrants would be screened for asylum eligibility before being allowed entrance into Europe.

But containing migrants in Africa doesn’t solve the migration crisis; some of these North African migrants have been displaced to bordering countries like Algeria. Just last month, the Associated Press reported that over 13,000 African migrants were being expelled from the country — some sent into the Sahara desert without food or water, forced to travel to Niger barefoot. The EU said they were aware of the mass exodus, but that “sovereign countries” are allowed to expel migrants as long as they adhere to international law.

Put together, this suggests that Europe doesn’t really want to fix the migrant crisis. And the many people searching for a better life — or safety — in Europe? They’re probably going to have to find another home.