Mesut Ozil said he had been unfairly blamed in Germany for the side’s shock first-round defeat at the World Cup 2018 and he also targeted DFB president Richard Grindel.

Mesut Ozil, criticized for his controversial photograph with Turkish President Recep Tayyip Erdogan, said on July 22, 2018 that he will quit the Germany national football team. (AFP)

Mesut Ozil said Sunday he was quitting the German national football team, citing “racism” in the criticism of him in the side’s World Cup debacle.

“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 whilst I have this feeling of racism and disrespect,” he tweeted.

Ozil, who has Turkish roots, had earlier defended his decision to pose for a controversial photograph with Turkish President Recep Tayyip Erdogan in May which sparked questions about his loyalty to Germany’s squad ahead of the World Cup in Russia.

In a three-part statement on Twitter sent over the course of the day, an angry Ozil saved his bombshell for the final salvo.

In it, the Arsenal midfielder blamed the German Football Federation (DFB) for failing to defend him against his most strident critics.

“Arguably the issue that has frustrated me the most over the past couple of months has been the mistreatment from the DFB, and in particular the DFB President Richard Grindel,” he said.

He said that Grindel and Germany coach Joachim Loew had asked him to give a “joint statement to end all the talk and set the record straight” over the picture with Erdogan.

“Whilst I attempted to explain to Grindel my heritage, ancestry and therefore reasoning behind the photo, he was far more interested in speaking about his own political views and belittling my opinion.”

Ozil said that despite the timing of the picture with teammate Ilkay Gundogan and Erdogan -- shortly before the president won re-election in a poll endowing him with sweeping new powers -- “it wasn’t about politics or elections, it was about me respecting the highest office of my family’s country”.

“My job is a football player and not a politician, and our meeting was not an endorsement of any policies,” Ozil added.

Germany is home to more than three million people of Turkish origin.

Ozil and Gundogan were booed by German fans in pre-World Cup friendlies after posing with Erdogan in London.

Manchester City midfielder Gundogan presented him with a signed club shirt on which he had written “to my president”.

After the tournament, Ozil came in for stinging criticism by DFB officials and German politicians across the spectrum.

Team boss Oliver Bierhoff suggested after the debacle that Germany should have considered dropping Ozil after his failure to explain himself over the Erdogan picture.

Bierhoff later backtracked, saying that he “was wrong” to put Ozil under undue pressure, but the picture continued to draw scorn from fans on social media.

Meanwhile, former captain Lothar Matthaeus accused Ozil of no longer looking comfortable in the Germany shirt.