A migrant from Syria has admitted in court that he attacked an Israeli man wearing a skullcap in Berlin.

The 19-year-old man lashed out with his belt at the man in broad daylight in a street in the German capital.

The young migrant apologised for his actions.

The attack in April was filmed by the victim on his smartphone and sparked outrage when shared on social media, triggering street rallies in solidarity with Germany's Jewish community.

But it also led to the leader of Germany's Jewish community advising Jews to avoid wearing traditional skullcaps (kippahs) in big cities.

Footage of the assault shows the attacker shouting "yahudi", Jew in Arabic, before lashing out and injuring the Israeli man.

The victim, a 21-year-old student, later said that he was not Jewish but an Israeli Arab.

He told the German broadcaster Deutsche Welle that he and his friend had wanted to test whether wearing a kippah was safe in inner city Berlin.

In court, the 19-year-old defendant, named in German media as Knaan al-S., said he was under the influence of drugs at the time of the attack.

He was registered at a refugee home in Brandenburg state outside Berlin, but when he carried out the attack he was living "out of a suitcase" in the capital.

"I'm sorry, it was a mistake. I didn't want to hit him, I only wanted to scare him," the defendant told a Berlin court according to the German news agency DPA.