It is a club to which neither wants to belong. But Richard Ratcliffe and Daniela Tejada have built an alliance in adversity based on their shared trauma: the detention of their British spouses abroad.

Last week, as Matthew Hedges, Tejada’s husband, was sentenced to life in a United Arab Emirates prison, Ratcliffe, the husband of Nazanin Zaghari-Ratcliffe, immediately got in touch with her to express his solidarity and support.

“We exchanged messages. I just really wanted to say: listen, we’ll be by your side. And good luck. Because it’s really tough, the first few days,” he told the Observer. “You’re going out, battling for your family on the airwaves, speaking in the way that’s quite raw... You can feel really besieged.”

Few will have been able to understand Tejada’s suffering like Ratcliffe, who is continuing a 31-month battle to free his wife from an Iranian jail. The 39-year-old, mother to Gabriella, aged four, has been incarcerated since April 2016 and is serving a five-year sentence.

Hedges, 31, has been detained in the United Arab Emirates for more than six months and was sentenced last Wednesday after being convicted, without his lawyer present, in a court hearing that lasted less than five minutes. There are growing hopes that he will be freed in the face of pressure from the UK and a plea for clemency by his family, and that a pardon could come as soon as this week.

But for Tejada the wait and uncertainty will be agonising, as Ratcliffe knows only too well.

“Naturally Daniela and I have an instinctive understanding of what each other’s going through. We met to share experiences and support each other,” he said. “I feel like people who are in a similar situation to me understand better than others can – and I think she felt the same as well. We are both in a quite similar place. In some ways it’s the same story.”

The Foreign Office is always very cautious, which can lead to a sense of alienation Richard Ratcliffe

Both Zaghari-Ratcliffe and Hedges deny charges of spying for the UK government. Their spouses, who met for the first time last month at a play about Zaghari-Ratcliffe’s imprisonment, have called repeatedly on the Foreign Office to do more to secure the release of their loved ones.

Last week Tejada spoke of how the Ratcliffe family had been an inspiration for her – “just the strength of their relationship and resilience and how brave they’ve been”, she told Agence France-Presse. “I’m a firm believer that every sky has a dark cloud that has to pass at some point.”

Ratcliffe said there was a community of families of innocent British citizens imprisoned abroad, some of whom have been released, that provided support and encouragement for one another. “We don’t really get to help each other solve any problems but we do get to remind each other that there will be an afterwards, that there’s a life beyond, that we will get through it. People have done that for me and I think that’s an important part of what we can do for each other as families.”

He and Tejada have voiced their frustration at what they say has been a callous lack of consideration from the Foreign Office. Tejada said on Radio 4 last week she had been told the department did not have a duty of care towards Hedges, a PhD candidate at Durham University, while careless remarks by the former foreign secretary Boris Johnson were used against Zaghari-Ratcliffe in Iran. Ratcliffe has been more positive about the treatment of Nazanin’s case by Jeremy Hunt, Johnson’s successor, who met Gabriella in Tehran this month.

“The Foreign Office is always very cautious at the beginning and careful about what it shares with families – which can lead to a sense of alienation. It did in our case,” he says. “You can end up being quite angry and think that the government is not doing enough. Part of campaigning is always pushing the government forwards.”

He hopes he can use his experience to help Tejada. “Campaigning is a struggle to work out what the right thing to do is, and it’s a struggle to work out how disinterested the advice is that you get. I think that trust is automatically there with other families.”

He offered some insight into how Tejada was feeling: “For me, the hard bit is when you focus on the sentence, because it sounds such a big, awful and all-encompassing sentence, you know. Certainly five years felt that way. People sat me down to say, ‘Listen, you have to understand that the sentence doesn’t mean what it says.’ What it means is [the Iranian government] is unhappy and is signalling that. The number’s not relevant. It’s just a signal that we’re unhappy.”

Ratcliffe said Tejada needed to remain optimistic that Hedges would be freed imminently. “The most important part for me of campaigning these days is hope, and the way in which it keeps hope alive. It’s the hope of all the other people outside who are caring or supporting and coming to events. And that’s part of I think what as families we can do for each other.”