(CNN) Two European countries tried to deport him. He served jail time in one of them.

But Anis Amri never got sent back to his home country of Tunisia.

This week, he became Europe's most wanted man after allegedly plowing a truck into a Berlin Christmas market, killing 12 people and injuring dozens of others

As details emerge, a key question looms: If Italy and Germany both wanted to deport him, why was Amri still in Europe in the first place?

The case highlights an issue that governments around the world face. Deporting someone -- even a criminal convicted of violent offenses -- is harder than it sounds

It takes two

The bottom line: In order to deport someone, the person's home country has to cooperate.

In Amri's case, Italian and German officials both say their efforts to deport him ran into roadblocks when it came to getting the documents needed to send him back.

Italian authorities say Amri served four years of jail time for assault, arson and damaging state property at the country's Lampedusa refugee center. They ordered his deportation, Italian state police spokesman Mario Viola said. But Tunisian authorities wouldn't accept the request on the grounds of a lack of proper documentation, Viola said.

Amri was denied asylum in Germany but was not deported because he had no official papers, and his identity could not be determined, officials there said.

Tunisian officials could not be immediately reached for comment on Amri's case.

'Cat and mouse'

In Europe, it's common to hear of cases of immigrants who were ordered to leave but remain, said Demetrios Papademetriou, president of the Migration Policy Institute Europe.

"It's a cat and mouse game that is extremely prevalent between countries who are trying to return nationals to their countries of origin, and countries of origin saying, 'Sorry, does this person have a passport or any other ID that will let us know that, indeed, he's one of ours?' "

For years, he said, European officials have been reluctant to use leverage to pressure other countries to accept deportees.

In Germany, more than half a million people with failed asylum applications who were supposed to leave or be deported remain in the country, Papademetriou said, citing a recent parliamentary inquiry.

"There are probably well over a million people in the European Union who are in the same place," he said.

Photos: 24 hours of Europe's migration crisis Migrants wear identification bracelets aboard a Norwegian ship during a search-and-rescue mission off the Libyan coast on Tuesday, September 1. Europe is in the midst of a migration crisis. Desperate men and women, often with children in tow, are fleeing wars and poverty to find a better life on the continent. But their voyages, both on land and on sea, can be dangerous and sometimes deadly. Hide Caption 1 of 13 Photos: 24 hours of Europe's migration crisis Hide Caption 2 of 13 Photos: 24 hours of Europe's migration crisis The body of a drowned migrant remains on a shore in Zuwara, Libya. In the last week , two boats carrying hundreds of people capsized near Zuwara, killing at least 84, officials said. Hide Caption 3 of 13 Photos: 24 hours of Europe's migration crisis A migrant shouts at Macedonian police officers while trying to cross Greece's northern border into Macedonia. About 1,500 migrants were waiting to cross the border. Hide Caption 4 of 13 Photos: 24 hours of Europe's migration crisis A young girl from Iraq waits for registration with her family outside the main station in Munich, Germany. Hundreds of migrants are arriving every day. Hide Caption 5 of 13 Photos: 24 hours of Europe's migration crisis Migrants sit outside the main station in Munich as they wait for their chance to register. Hide Caption 6 of 13 Photos: 24 hours of Europe's migration crisis A group of refugees continues its journey through Hungary after crossing the Serbian border. Hide Caption 7 of 13 Photos: 24 hours of Europe's migration crisis Syrian refugees walk across railways tracks next to the Serbian town of Horgos to cross the border and enter Hungary. Hide Caption 8 of 13 Photos: 24 hours of Europe's migration crisis Migrants sit in a police bus in Pocking, Germany, after making their way to the country from Austria. Hide Caption 9 of 13 Photos: 24 hours of Europe's migration crisis Migrants from Afghanistan drink tea at a Paris school where they found shelter. Hide Caption 10 of 13 Photos: 24 hours of Europe's migration crisis A migrant sleeps on a sidewalk in Berlin near the reception center for refugees and asylum seekers. Hide Caption 11 of 13 Photos: 24 hours of Europe's migration crisis Migrants walk on a rocky beach in Ventimiglia, Italy, where they set up camp near the French border. Hide Caption 12 of 13 Photos: 24 hours of Europe's migration crisis Refugee children sleep near a railway station in Budapest, Hungary. Hide Caption 13 of 13

'Clear public safety threat'

Officials around the world have faced similar predicaments.

In the United States, officials use the term "recalcitrant" to describe countries that won't take back people the US authorities are trying to deport.

There are 23 countries US Immigration and Customs Enforcement describes as recalcitrant, including Afghanistan, Algeria, China, Cuba, Gambia, Iran, Libya, Somalia and Zimbabwe.

"There is a clear public safety threat posed to the United States by the failure of uncooperative or recalcitrant countries to accept the timely return of their nationals who have committed crimes in this country," Daniel Ragsdale, the agency's deputy director, testified earlier this year.

The issue has become a flashpoint for some Republican lawmakers, who've said the United States should fire back by denying visas to countries that refuse to take back their citizens.

Changing times?

This week's attack in Berlin could spur European governments to take a different approach to deportations, Papademetriou said.

Now, he said, they will likely be more willing to use leverage to force home countries to take back deportees.

"It is because of Berlin that I expect things to change. The process is to be accelerated," he said.

Some officials have already been ramping up those efforts, he said, pointing to recent deals the European Union reached with Afghanistan and Mali.

Leaders across Europe are turning more attention to enforcing immigration regulations, Papademetriou said, as they face growing political pressure from far-right groups.

"Clearly," he said, "they have been realizing that they'd better do this, before they start losing elections, big time."