A "desperate" man whose identity baffled police for weeks left his remote Moroccan village to find work illegally, a court heard.
Ibrahimi told police he was "cold and desperate"
Hassan Ibrahimi paid £1,000 to a people trafficker to take him to France. But he was dropped in a Carmarthenshire village unable to speak English.
He admitted burglary after breaking into a local house. He said he was looking for food and shelter.
Llanelli magistrates adjourned sentence and he was remanded in custody.
His solicitor Mike Reed told the court that it was "quite a unique case".
He said: "About two years ago there was an earthquake in the village where he lives. His home was destroyed and his parents were both killed, and his brother.
"He managed to get work in a cafe, where he also slept, earning the equivalent of £35 a week and he saved up that money.
"Having lost everything, he decided to try and leave Morocco and come to France because the Berber language is similar to French."
Mr Reed said he paid two million in the Berber currency - about £1,000 - to two men.
But after a three-day journey by car and ferry, Ibrahimi was dropped off in Tycroes near Ammanford.
Ibrahimi did not know where he was when he was dropped in Tycroes
Without any money, he initially made a den in a hedge, but when he became cold and hungry he broke into a nearby house.
When arrested in September, police had no idea of his name or nationality, as they did not know what language he spoke.
Only after a translator saw news reports about the case was it established that he lived in a remote village in the Moroccan mountains and spoke the Berber dialect.
Prosecuting, Catherine Collins said he broke into the same house three times, taking groceries, clothing, a sewing kit and a toothbrush.
On one occasion the owner came home and found him but he escaped through a window.
"When the home-owner returned the next day he noticed someone had been eating a meal and the bed had been slept in," Ms Collins said.
Police installed an alarm, which was triggered when he broke in again. When finally interviewed by police via a translator, he said he was "cold, desperate and had no choice".
Ms Collins said: "At the end of the interview he said he was very sorry but he was desperate and did not know what else to do."
Ibrahimi believed he was 26 but did not know his date of birth.
He was remanded in custody until 17 November. Deportation papers were also served.