The group, which is not classed as a terrorist organisation by the UK, was supported by the British military and US-led coalition to drive Isis out of its former territories.
While other YPG volunteers have been investigated by counterterror police, Mr James was the first man to be put on trial for terror offences related to fighting against Isis.
He was charged with preparing acts of terrorism, which has previously been used against would-be Isis militants and terror attack plotters.
But the judge at his Old Bailey trial said Mr James had “no case to answer” and directed the jury to acquit him.
Jurors then failed to reach a verdict on two remaining charges of attending two locations “while terrorist training was given” by Kurdish groups.
Justice Edis discharged the jury after 14 hours of deliberations on Monday and prosecutors said they would be seeking a retrial.
The case was adjourned until 1 May, for a hearing to set a new trial date.
Mr James denied all offences, saying that his activities did not have a “terrorist purpose” and his aim was to fight Isis.
But prosecutors argued that his activities with the YPG fulfilled the definition of terrorism in British law, which is activity “for the purpose of advancing a political, religious or ideological cause”.
Mark Heywood QC told the jury Mr James had planned in “an amateurish way” to take part in violence in the Syrian civil war.
“He claimed that his aim was to combat Islamic State,” he added. “In reality, it was not just that – there was much more to it.”
Mr Heywood said: “The prosecution case against him is that he went as an individual to Syria to fight with guns and explosives.
“In doing so, he set out to advance a political and ideological cause. Because his intended use or threat of active violence was of that kind and for those purposes, the law says that what he wanted to do was terrorism, even if his eventual fighting was against other terrorists.”
The 28-year-old father, who was previously rejected by the British Army and has a history of mental illness, was approached by officers from the Prevent counter-extremism programme before leaving the UK and warned that he could be prosecuted.
“The road to Rojava [northern Syria] starts here, few weeks from now will be in Syria fighting side by side with brothers in arms against the sick regime and ideologies of the so-called Daesh [Isis] and other Islamic extremists,” read a Facebook post in April 2017. “I don’t care for people’s opinions, this is what I want to do and need to do.”
The court heard that Mr James was arrested and had his passport seized, but the investigation was closed with no further action and the document was returned.
He travelled to Iraq in August 2017 and went on to fight against Isis with the YPG in Syria.
Prosecutors accused Mr James of attending places where “terrorist training was given” in the Iraqi district of Makhmour, and later in Syria.
The court heard that he met fighters from the PKK (Kurdistan Workers’ Party), which is a Kurdish terrorist group with links to the YPG, in Makhmour but Mr James denied anything other than an “incidental association” and said he did not fight for the banned organisation.
Mr James underwent a month-long YPG training course before being deployed to fight against Isis in Deir ez-Zor, taking part in battles to regain occupied towns.
The court heard he decided to leave Syria in December and returned to the UK via Erbil, Baghdad, Jordan and the Netherlands.
He was arrested when he landed at Liverpool Airport in February 2018, after just over five months abroad.
The YPG, which is part of the Syrian Democratic Forces coalition, has been backed by the British military and US-led coalition over years of battles to drive Isis out of its former territories.
Several British people who joined the YPG have been arrested and questioned by counterterror police, with some having their passports and phones seized, but faced no further action.
Eight British volunteers with the group – seven men and one woman, have been killed in action.
One volunteer, former soldier James Matthews, was also charged with “attending a place used for terrorist training” but the case was dropped before trial last year.
A third YPG volunteer, Joshua Walker, was acquitted of an unrelated terror offence after police found a copy of the Anarchist Cookbook while searching his home.
On Friday, new terror laws came into force that make it an offence for anyone to enter “designated areas” abroad, but it cannot be applied retrospectively.
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in