Pakistan released an FBI agent on bail on Thursday after three days in custody, officials said, a move that is likely to prevent the situation from escalating into a diplomatic spat.

The American man was detained after airport authorities found him carrying ammunition and three knives on Monday as he was about to board a flight for the Pakistani capital, Islamabad.

The arrest threatened to open a new chapter in troubled relations between Pakistan and the U.S., which have been uneasy allies since the September 11 terror attacks. But the relatively fast release, if confirmed, suggested efforts to defuse any tensions.

A law enforcement official in the U.S. has said the man was an FBI agent and said he was in Pakistan as part of a multi-agency, anti-corruption programme. The official, who spoke on condition of anonymity because of the diplomatic sensitivities of the case, said the agent appeared to have made a mistake and didn’t mean to carry bullets aboard the plane.

U.S. State Department spokeswoman Jen Psaki confirmed the detention on Wednesday and said the U.S. was coordinating with Pakistani authorities to resolve the matter. She did not identify the man.

A Pakistani court directed the man to submit a surety bond of Pakistani Rs. 1 million ($9,800) for his bail, police officer Rao Anwaar said. The American arrived in Karachi on May 1 and was detained after officials found him with the ammunition, knives and electronic devices that were being examined.

Other police officials said investigators were under immense pressure from the Interior Ministry and other government officials to release the American so the report was rushed. They found he had no criminal intention in carrying the bullets during domestic air travel, the officials said, speaking on condition of anonymity in exchange for release the details.

Washington needs Pakistan’s help fighting al-Qaeda and stabilising neighbouring Afghanistan, as NATO uses Pakistani roads to supply its troops. However, relations have strained over a series of incidents. CIA contractor Raymond Davis shot and killed two Pakistani men in Lahore in January 2011. The U.S. unilaterally killed Osama bin Laden in the Pakistani city of Abbottabad in May 2011 and American forces accidentally killed 24 Pakistani troops along the Afghan border the same year. U.S. drones strikes in the country also have angered Pakistanis.