When you've walked 4,000 miles seeking a better life in the West, it takes a lot to even consider returning to your war-torn homeland.

For Khasim, that moment came last summer when a gang of at least five men ambushed him, fracturing his jaw, and leaving the young Afghan slumped and bloodied on a backstreet in Athens, Greece.

Struggling to get by in a foreign land and sobered by the severe beating, Khasim gave up on his dream of making his way to Germany.

He visited the International Organization for Migration which arranged for the Greek government and the European Union to pay him $1,705 to return to Afghanistan's capital of Kabul.

“I told them I want to go home,” Khasim, now 21, said.

Khasim's epic journey to Greece started in Kabul, Afghanistan. NBC News

When NBC News met the former dentistry student in Athens a year ago, he was selling his body around Omonia Square to survive.

He seldom made more than 20 euros ($25) for sex. An influx of other young migrants had driven down the prices.

“We have great shame, we’re not gay, we don’t like doing this job. ... If you live on the street, you have to do what you have to,” Khasim said at the time.

But over the course of many months, he repeatedly dismissed the idea of returning to Afghanistan.

Opting for the United Nations-operated Assisted Voluntary Return and Reintegration program was a big decision. Khasim had spent more than $11,000 of his family’s money to get to Europe, including payments to smugglers.

Khasim, who did not want to be identified by his real name because his family was unaware that he was a sex worker in Greece, said he walked more than 4,000 miles through Iran, Bulgaria and Serbia, eventually reaching Athens.

But life soon became intolerable. "Athens is so bad," he said via Facebook Messenger shortly after NBC News met him last year. "If I do not go to Germany, I'll kill myself."

He never made it. Khasim hit rock bottom after last summer's attack and became desperate to leave.

“I did not have a place in Greece to sleep, and I did not have money to eat,” he said.

"Italy, London, Germany, France — no problem. Just I want to go from f------ Greece," Khasim wrote in one message, accompanied by a crying-face emoji.

Khasim had found himself living in the country with the highest unemployment rate in Europe — currently more than 18 percent. Greece is still grappling with the fallout of the 2008 debt crisis and a continual flow of migrants arriving on its shores, which have left an already-stressed welfare system struggling to cope.

Omonia Square in Athens is where Khasim connected with many of his clients. Marko Drobnjakovic / for NBC News

And he was trapped there. At the height of Europe's migration crisis in 2016, the Balkan countries to the north of Greece had closed their borders.

When NBC News met Khasim last year, he had already tried to leave the country four times using stolen or fake passports, but he kept getting caught. He subsequently made several other unsuccessful attempts.

He was not alone in his predicament and spent most of his time roaming the streets with Fazul, an Afghan friend who also asked to be identified only by a pseudonym.

The money the two earned from sex went toward food and cigarettes. Sometimes, it stretched to a cheap hotel room for the night. Otherwise, they slept in parks or another nearby square.

Fazul said he spent a big chunk of his money on marijuana to relax, often leaving little to spend on food or shelter.

Khasim is unsure what has become of Fazul.

“He was in Athens, he still smoked shisha and marijuana,” he said. “I don’t know if he is alive or dead.”

Fazul, left, crosses a street in central Athens alongside Khasim on March 29, 2018. Marko Drobnjakovic / for NBC News file

Despite his experiences in Europe, after only three months of being back home in Afghanistan after help from the U.N. program, Khasim told NBC News in January that he now regrets his decision and wants to head back to the West.

He was overjoyed to see his family, particularly his mother whom he spoke to three times each day while in Greece.

But Khasim said his relatives don't understand why he chose to return to a country where a resurgent Taliban is fighting U.S.-led NATO forces and the government of President Ashraf Ghani.

“They ask, ‘why did you come back to Afghanistan, to no jobs,’” he said, explaining that his mother needs him to contribute to pay their rent and look after his younger siblings. “‘The life of people in Europe is better, there is no Taliban in Europe,’” he added, mimicking his mother's lectures.

Khasim concedes his mother is right.

“If you work one month in Afghanistan, it’s 100 euros ($114), if you work in Europe its 1,000 euros ($1,140) or 700 euros ($797),” he said.

Khasim's return to the Afghan capital has been difficult. Wakil Kohsar / AFP - Getty Images

But because his relatives don’t know how he earned money in Greece — and Khasim says he can never tell them — they don't have the full picture.

Abdul Ghafoor, who runs the Afghanistan Migrants Advice and Support Organization in Kabul, said it was common for families not to understand why people return to such a troubled homeland.

“The idea of deportation or returning voluntarily, often their families don’t understand the nuance," he said, adding that, "Did you do something criminal?" was a regular question that returning migrants heard.

Liza Schuster, an expert on return migrations to Afghanistan at City, University of London, said families often will have made a significant financial sacrifice to send someone to Europe and can be angry if they later show up on the doorstep.

“You can find two, three, four, five, very angry brothers saying, 'We’ve put all of this together to save you and now not only are you not safe ... but we’ve got no future, we have nothing,'” she said.

Khasim says he hopes to leave again for Europe as soon as he has the money to pay the smugglers.

This time, he hopes to reach Germany so that he can go and live with his brother in Munich.

He is certain that he does not want to return to Greece.

“My family will sell some gold so I can go again,” he said. “They say I must go again.”