This is the story of how an office supply glitch became a major irritant between the United States and one of its close security partners.

When President Donald Trump added the African nation of Chad last month to his most recent instalment of travel restrictions, everyone from the Pentagon to Chad's leaders to the French government was perplexed. The US has praised Chad's cooperation on counterterrorism, especially its campaign against a vicious Boko Haram insurgency spilling over from Nigeria.

As it turns out, a seemingly pedestrian issue was largely to blame: Chad had run out of passport paper.

Chad and every other country had been given 50 days to prove it was meeting a “baseline” of security conditions the Trump administration says is needed for the US to properly screen potential visitors. One condition was that countries provide a recent sample of its passports so that the Homeland Security Department could analyse how secure they really are.

Lacking the special passport paper, Chad's government couldn't comply, but offered to provide a pre-existing sample of the same type of passport, several US officials said. It wasn't enough to persuade Homeland Security to make an exception to requirements the agency has been applying strictly and literally to countries across the globe, said the officials, who requested anonymity to discuss disagreements within the administration.

Still, the US told Chad it could be removed once the issues were addressed, with national security adviser H.R. McMaster saying at the time that Chad could come off the list “maybe in a couple of months.” McMaster spoke to Chadian leader Idriss Deby last week about getting the visa restrictions removed, the State Department said, but the country remains on the list.

At least that was the case until Tuesday, hours before the new restrictions were to take effect, when a federal judge in Hawaii blocked Trump's order, saying it had the same legal problems that foiled the first two iterations of his “travel ban.” The move puts the restrictions temporarily on hold, but Trump's administration has pledged to appeal.

The Homeland Security Department confirmed that the US “lacks a recent sample from Chad” of its passports, but said there were other problems, too.

“The restrictions placed on Chad dealt with more than just the receipt of a passport exemplar. Chad does not adequately share public safety and terrorism-related information,” said Homeland Security spokesman David Lapan. He said the US was working closely with Chad on the issue and was “eager to see Chad develop more secure travel documents and make other enhancements.”

It was unclear why Chad ran into the office supply problem, although regional upheaval and the persistent terror threat have disrupted trade in the impoverished country in recent years. For a recent period of about six months, Chad stopped issuing passports, although it appears that situation has since been resolved.

The passport paper issue helps to illustrate the infighting within Trump's administration that led up to the revised travel order, which also placed restrictions on Iran, Libya, North Korea, Somalia, Syria, Yemen and Venezuela.

Activists protest Donald Trump's proposed Muslim ban Show all 11 1 /11 Activists protest Donald Trump's proposed Muslim ban Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty Activists protest Donald Trump's proposed Muslim ban People listen to speakers at a demonstration against racism and conservative presidential candidate Donald Trump's recent remarks concerning Muslims on December 10, 2015 in New York City. Dozens or demonstrators and activists converged at Columbus Circle to denounce the politics of Trump and the treatment of Muslim refugees both in America and Europe. Spencer Platt/Getty

Homeland Security, working with the White House, pushed Chad onto the list without significant input from the State Department or the Defence Department, said a congressional official briefed on the process who wasn't authorised to discuss it publicly and requested anonymity.

Other officials said once the other national security agencies learned of the plan to add Chad, they objected vehemently, but were overruled.