A German football star of Turkish heritage has quit the national team and blamed “racism and disrespect” after he was criticised for posing for photos with the increasingly authoritarian president Recep Tayyip Erdoğan.

Mesut Ozil, 29, claimed it “would have been disrespecting the roots of my ancestors” to not meet president Erdoğan at a London event in May.

The photos were released by Erdoğan’s ruling AK Party in the build-up to elections in the country, but Mr Ozil insisted the stunt was not politically motivated.

“It wasn’t about politics or elections, it was about me respecting the highest office of my family’s country,” he wrote in a social media statement.

Ozil is a third-generation Turkish-German, who was born in Gelsenkirchen, and played a key role in Germany’s 2014 World Cup victory.

However, he now says he has received hate mail and threats and is being blamed for Germany’s disappointing recent World Cup. “I am German when we win, but I am an immigrant when we lose.”

He added: “It is with a heavy heart and after much consideration that because of recent events, I will no longer be playing for Germany at international level while I have this feeling of racism and disrespect.”

The past couple of weeks have given me time to reflect, and time to think over the events of the last few months. Consequently, I want to share my thoughts and feelings about what has happened. pic.twitter.com/WpWrlHxx74 — Mesut Özil (@MesutOzil1088) July 22, 2018

“I used to wear the German shirt with such pride and excitement, but now I don’t. I feel unwanted and think that what I have achieved since my international debut in 2009 has been forgotten.”

Germany’s football association, the DFB, was among those to criticise Mr Ozil after the photographs surfaced, and Monday afternoon they “emphatically rejected” his claims of racism.

President Erdoğan is accused of kidnapping, imprisoning, and even killing journalists, and the DFB said in a statement:

“What must connect us all within that, both on and off the pitch, is respecting the human rights firmly established in our constitution and standing up for the freedom of expression and freedom of the press, as well as respect, tolerance and fair play.

“A commitment to these core values is a prerequisite for every person who plays football for Germany. Therefore, the pictures with Turkish president Erdoğan raised questions for many people in Germany.”

A spokeswoman for the German Chancellor, Angela Merkel, declined to comment but members of her conservative Christian Democratic Union party and the government were more outspoken.

“No one has to deny their country of origin,” Thomas Strobl, the interior minister of Baden-Württemberg, said.

“But I would also wish for a clear commitment to one’s new homeland. And I would also wish for a clear commitment to our values – especially towards someone like Mr Erdoğan.”