Pakistan released an FBI agent on nearly $10,000 bail 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 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 Sept. 11 terror attacks. But the relatively fast release suggested efforts to defuse any tensions.

Washington needs Pakistan’s help fighting al-Qaida and stabilizing neighboring 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.

Interior Minister Chaudhry Nisar Ali Khan said the current case should not be compared with the Davis shootings, pointing out the FBI agent had not been carrying a weapon.

“He was caught and a court today granted him bail,” the interior minister said at a news conference. The U.S. Embassy in Islamabad did not immediately respond to a request for comment.

Foreign Ministry spokeswoman Tasnim Aslam said the man detained “was not a diplomat and therefore, had no immunity.” She added he was in Pakistan on a short-term visit and had a valid visa.

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 program. 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 said Wednesday that the U.S. was coordinating with Pakistani authorities to resolve the matter. She did not identify the man.

The Pakistani court directed the man to submit a surety bond of 1 million rupees ($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.

He said the release came a day after police completed the investigation and submitted the report to the court.

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.

___

Associated Press writers Munir Ahmed in Islamabad and Eric Tucker in Washington contributed to this report.