Story highlights Agent was stopped for carrying ammunition as he attempted to board flight

Joel Cox was carrying 15 9mm bullets, police said

The agent is in Pakistan as part of effort to train local police

Diplomatic effort under way to gain the agent's release

An FBI agent was arrested in Pakistan this week after he attempted to board a domestic flight between Karachi and Islamabad with ammunition and knives, police said Wednesday.

Joel Cox was arrested on Monday with 15 9mm bullets, three small knives and a wrench, according to police superintendent Malir Rao Anwar. All of those items, along with his laptop computer and cell phone, have been taken to a forensics lab for analysis.

Cox was visiting Pakistan as part of an assignment to provide training to local police, according to a U.S. law enforcement official.

A State Department official said diplomats are working with Pakistani authorities to gain the release of the agent.

Cox appeared in court Tuesday to face anti-terrorism charges, which restrict unauthorized weapons or ammunition on commercial flights, and is scheduled to appear again on Saturday.

Employees for the FBI and other U.S. agencies are allowed to carry weapons in Pakistan when authorized.

U.S. officials hope this incident is more easily resolved than the 2011 case of a CIA contractor who was arrested and charged with killing two men. Raymond Davis said that he believed they were trying to rob him.

The case inflamed local anti-American sentiment and soured relations until the United States agreed to compensate the families of the two men. Davis was then freed.

Rao Anwar said he expects the case to go to trail, calling it a matter of "upholding Pakistan's dignity and honor. (Cox) acted illegally and his arrest is perfectly legal."