On March 2 and 3, German Chancellor Angela Merkel travels to Egypt and Tunisia. Concerns about migration and refugees will top the agenda of her talks with Egypt's President Abdel Fattah el-Sisi and Tunisian Prime Minister Youssef Chahed.
As she prepares for crucial elections this September, for many voters Merkel's tenure is associated with the record number of 900,000 refugees that came to Germany in 2015 (another 280,000 arrived in 2016).
The chancellor is under pressure to keep the promise she made late last year: "A situation like we had in the late summer of 2015 can, should and must not repeat itself."
This promise was her answer to the charges of "loss of control" that have been have the heart of the case against Merkel by critics from within her own party and also the far-right Alternative for Germany (AfD).
To make good on her promise, Merkel needs the cooperation of North African countries which therefore have become a key focus of German diplomacy.
Thanks to the border controls in the Balkan states - leaving refugees stranded in Greece - and the European Union-Turkey deal, the number of migrants coming to the EU from Turkey has gone down significantly.
This has shifted the focus back to the Central Mediterranean. In 2016 alone, 181,000 migrants and refugees reached Europe irregularly with the help of traffickers operating out of war-torn Libya and other countries including Egypt. Many died while making the perilous crossing.
Germany and other EU countries seek to end this situation. As agreed at a recent EU Summit in Malta last month, the key goal is to "ensure effective control of our external border and stem illegal flows into the EU".
Political leaders in Germany and beyond have realised that only if the EU can demonstrate to its citizens that it is in control of its external borders, the Schengen passport-free travel zone, one of the key achievements of European integration, can survive.
Controlling borders is a precondition for sustaining open societies in Europe. Advocates of liberal democracy and open society will be punished at the ballot box if they are seen as allowing for uncontrolled immigration into Europe.
In this sense, controlling borders is also a precondition for sustaining the political willingness to welcome refugees in Germany - polls indicate continuing support for accepting refugees in a controlled process but returning them to their homeland once their countries are safe.
The need for control is an assessment widely shared across the political spectrum in Germany. The disagreement is on the trade-offs involved in dealing with transit countries in the Mediterranean.
Trouble at home and abroad
Green Party leaders have accused Merkel of "striking dirty deals" at any price. She has faced strong criticism for going soft on Turkish President Recep Tayyip Erdogan's authoritarianism for the sake of the deal on refugees.
She faces similar challenges in her dealings with the Egyptian president. Sisi has a record of repression and human rights abuse. German NGOs operating in Egypt (such as the Konrad Adenauer Foundation which is close to Merkel's party) have been harassed by Egyptian authorities, some, such as the Friedrich Naumann Foundation, even driven out of the country.
Still, Merkel has referred to Egypt as a "stabilising element" in the region. Her hope is that Egypt will play a constructive role in Libya, which is currently the weakest link in the North African refugee situation.
As long as there is no effective government in place and as long as the terrible conditions for refugees persist in Libya, hopes for any EU-Turkey style agreement with Libya remain pipe dreams.
Given the unstable situation in Libya, German politicians have set their sights on the more stable transit countries, including Tunisia. Christian Democratic Union Interior minister Thomas de Maiziere and Social-Democratic parliamentary leader Thomas Oppermann have both called for establishing EU asylum processing centres in North Africa.
The idea is for asylum requests to be handled by EU authorities in North Africa. This would allow to return migrants rescued by EU member state authorities in the Mediterranean to North Africa, thereby making illegal crossings less attractive and destroying the traffickers' business.
The fight between the [Hungarian PM Viktor] Orban-type ethnic nationalists and advocates of an inclusive nationalism is a decisive frontier in the battle for preserving open societies in Europe.
The Tunisian prime minister has rejected the idea, saying that this would destabilise Tunisia. This led Merkel to avoid the topic during Chahed's visit to Berlin last month. She did, however, press Chahed on cooperating better on returning rejected asylum seekers home from Tunisia.
This is a burning concern for Merkel given that young males from North Africa with no prospects for being granted asylum are seen as a very problematic group in the German public debate (the fact that Anis Amri, the perpetrator of the Berlin Christmas market attack, was a rejected asylum seeker from Tunisia only added to this). Merkel will likely press this issue again during her visit to Tunis.
Ethnic v inclusive nationalism
Other elements of Merkel's refugee policy also meant to keep numbers down are less controversial. These include spending more on protecting refugees in the Middle East and Africa and stepping up cooperation with African countries in the hope of reducing the reasons to migrate to Europe.
This is why economic development in Africa is one of the priorities of Germany's G20 presidency this year. More controversially, this also includes cooperation on more effective border control with regimes such as Eritrea that are the countries of origin for a number of asylum seekers making their way up north to Europe.
But cooperation with North African countries will remain the centrepiece of trying to reassert control. Indeed, the need to protect external borders and control migration flows is what unites all EU governments, from Germany to Hungary.
What divides them is how they deal with the issue of refugees and migrants - especially of Muslim origin - domestically. Just this week, Hungarian prime minister Viktor Orban called for "preserving ethnic homogeneity". Orban has consistently stoked fears of Muslim immigration as increasing terrorism and threatening Europe's cultural heritage in order to consolidate his power.
Other governments, such as Poland, have used similar language that has been echoed by the right-wing AfD in Germany. The fight between the Orban-type ethnic nationalists and advocates of an inclusive nationalism is a decisive frontier in the battle for preserving open societies in Europe.
Thorsten Benner is director of the Global Public Policy Institute in Berlin.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.