CAIRO — An American-Israeli law student who has been locked up in Egypt since June on suspicion of espionage remained in prison Tuesday, despite an appeal for his release from Defense Secretary Leon E. Panetta.

Panetta, in Cairo for a brief visit to meet with Egypt’s ruling military leaders, said he pleaded the case of Ilan Grapel, 27, a dual U.S.-Israeli citizen who was arrested in Cairo four months ago. Egyptian authorities have accused Grapel of gathering intelligence for Israel and trying to sabotage the popular revolution that toppled former Egyptian President Hosni Mubarak.

At a news conference, Panetta said U.S. officials urged their Egyptian counterparts to release Grapel but did not reveal details about the outcome of the discussions. “We’re confident that ultimately the Egyptian government will deal with that fairly,” said Panetta, a former CIA director, after holding separate meetings with Mohamed Tantawi, Egypt’s military chief, and its intelligence director, Mourad Mowafy.

Grapel was born in New York City. Before enrolling at Emory University, he served as a paratrooper in the Israel Defense Forces. Egyptian security officials took note of his presence in Cairo after they said he made repeated visits to Tahrir Square, the focal point of the massive demonstrations that forced Mubarak from office.

Israeli officials have insisted that Grapel is not a spy but so far have been unable to persuade Egypt to release him. Tensions between the two countries have risen in the aftermath of the Egyptian revolution.