Ayden James, 28, was convicted about his 2017 stay in an Iraqi base held by the Kurdistan Worker's Party (PKK) which is recognised as a terrorist organisation by the UK.
A British man who fought alongside a Kurdish militia against the so-called Islamic State (IS) in Syria was sentenced on Thursday to four years in jail.
Aidan James was convicted two weeks earlier of attending a place used for terrorist training but cleared of a second similar charge.
He was convicted over his 2017 stay in an Iraqi base held by the Kurdistan Worker's Party (PKK) which is recognised as a terrorist organisation by the UK.
However, he was acquitted over training and fighting he did in Syria with the Western-backed Kurdish People's Protection Units (YPG).
His trial was the first of the kind in the UK — other Britons who travelled to Syria to fight IS have had charges against them dropped.
Judge Edis noted that James had been warned not to travel to Iraq by counter-terrorism police officers.
A psychiatric report flagged that James suffers from some "psychiatric conditions related to traumatic experiences" but also "to substance abuse".
His jail sentence includes three years for a drug offence pre-dating his travels in the Middle East but which could not be dealt with until the conclusion of the prosecution for the terrorist offences.