A former British Army soldier who was charged with terror offences after fighting against Isis in Syria has attacked authorities’ “incoherent” approach to volunteers who risked their lives.

Jim Matthews was the first person prosecuted for fighting with the Kurdish People’s Protection Units (YPG) after dozens of British supporters joined their cause.

He told The Independent of his shock at being charged with a terror offence, two years after being arrested while arriving back in the UK.

“We [British YPG volunteers] went out there because our government was not doing enough,” Mr Matthews said. “It was a job that needed doing, we had to get Isis out of that territory.”

The 44-year-old, who left the Army in 1999 and later became a teacher, said it was a “strange contradiction” to be accused of terrorism after fighting against jihadis.

He believes Isis, which was committing genocide against the Yazidi people in Iraq and held swathes of Syria when he joined the fight, was the “most legitimate case for foreign intervention for a long time”.

“I would have been unlikely to go out if the British Army was also there fighting,” Mr Matthews added.

“I’ll always think about the battles I engaged in but ultimately I’m convinced it was the right thing to do.”

The YPG is not a proscribed terrorist group in the UK and its forces have been backed by the British military and international airstrikes to drive Isis out of its Syrian territories.

Syrian Democratic Forces take Raqqa from Isis – in pictures Show all 8 1 /8 Syrian Democratic Forces take Raqqa from Isis – in pictures Syrian Democratic Forces take Raqqa from Isis – in pictures Syrian Democratic Forces fighters celebrate victory in Raqqa atop of military vehicles REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures Fighters of Syrian Democratic Forces march past destroyed buildings as they celebrate victory REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures Fighters of Syrian Democratic Forces gesture the "V" sign in Raqqa REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures Fighters of Syrian Democratic Forces evacuate a civilian from the stadium REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures A civilian prays after she was rescued by fighters of Syrian Democratic Forces from the stadium REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures Syrian Democratic Forces fighters ride atop of military vehicles as they celebrate victory in Raqqa REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures Syrian Democratic Forces fighters celebrate victory in Raqqa REUTERS Syrian Democratic Forces take Raqqa from Isis – in pictures A fighter of Syrian Democratic Forces celebrates in Raqqa Reuters

But Mr Matthews was charged with “attending a place used for terrorist training” for attending the camp used for all recruits.

News of his prosecution sparked outrage last February, with supporters questioning how a person who risked their life to fight Isis could be considered a terrorist.

A second British YPG fighter, Aidan James, was later charged with terror offences and awaits trial, while fellow volunteer Ozkan Ozdil was arrested by counterterror police in December but faces no further action.

Mr Matthews said there was nothing to distinguish his actions from that of others who were never prosecuted, adding: “There is no coherent approach … I was considered a terrorist whereas the YPG aren’t.”

Mr Matthews, who is originally from Stoke-on-Trent, believes his appearance in a 2015 documentary flagged his role to authorities, but did not fear prosecution after fellow volunteers passed in and out of the UK unhindered.

He decided to fight against Isis after seeing a photograph of a jihadi holding a woman’s severed head on Facebook, contacting the YPG on Facebook and joining the group in January 2015.

Mr Matthews has written a book, Fighting Monsters, which describes the brutal reality of sometimes chaotic battles in Iraq and Syria.

It describes his friendship with fellow British volunteers Konstandinos Erik Scurfield and Jac Holmes, who were among eight UK YPG fighters so far killed in Syria.

Funeral for British Kurdish YPG fighter killed by ISIS sees procession in liberated Syria

Mr Matthews counts himself lucky to survive a year of bloody advances against Isis, and decided to return home in February 2016.

He was arrested at Portsmouth ferry port, then questioned, strip-searched and had his passport, laptop, phone and belongings seized.

While being interrogated about his purpose, he recalls a police officer remarking: “Well, the YPG aren’t on the proscribed list, but Turkey, which is a Nato ally, says they’re terrorists, so…”.

It took another two years on bail for the attorney general to authorise a terror charge, and he lost a teaching job as a result.

But on 31 July, the Crown Prosecution Service (CPS) announced that it would offer no evidence against Mr Matthews at the Old Bailey, and the case was dropped.

A CPS spokesperson said: “As a result of new evidence, specific to this case, we concluded there was no longer a realistic prospect of conviction. As such, the prosecution offered no evidence against Mr Matthews.”

In court, his lawyers had questioned whether “pressure from an oppressive foreign government has begun to influence the decisions of the UK legal authorities”.

They said Mr Matthews did not join YPG to advance a “religious, political, racial or ideological” cause, which is the definition of terrorism in British law.

James Matthews appeared in a Channel 4 documentary from the frontlines in 2015 (Channel 4)

“The defendant understood that his actions were in line with the foreign policy objections of HM government,” said a defence statement seen by The Independent.

Although the government considers the YPG to have “ideological and organisational links” to proscribed Kurdish terrorist group the PKK, it considers them separate organisations.

Alastair Lyon, a solicitor who represented Mr Matthews, told The Independent the case was “bonkers” and accused authorities of treating YPG volunteers “in a completely random way”.

“There remains no answer from the authorities as to why this case was brought or why it was dropped,” said the lawyer, of Birnberg Peirce.

“On its face, this case is a clear example of how terrorism laws of such breadth and legal uncertainty can be used to target blameless individuals for political benefit.”

A spokesperson for the attorney general’s office said: “The CPS is operationally independent and makes its decisions to prosecute independently of government.”

Mr Matthews is now living in Britain and teaches English at a private language school in London, but fears the legal ordeal will haunt him.

He was “interrogated strenuously” before being allowed to fly to Russia during a period on unconditional bail and believes he may be on a watchlist.

“If I had that experience again I wouldn’t be at all surprised,” he added. “It has been tough, I’d be lying if I said it wasn’t. I came back from a year of war straight into being arrested, so it’s been testing.”

Jim Matthews was charged with a terror offence but six months later, prosecutors presented no evidence against him in court (Lizzie Dearden)

A spokesperson for the Metropolitan Police said: “Police actively seek to investigate everyone who returns from taking part in the conflict in Syria or Iraq, to determine if they have committed criminal offences and to ensure that they do not pose a threat. “Any decision on whether to prosecute is taken by the CPS on a case-by-case basis.”

A Home Office spokesperson said that the government advises against all travel to Syria and parts of Iraq.

“Anyone who does travel to these areas, for whatever reason, is putting themselves in considerable danger,” a statement added.