A stone-throwing Palestinian protester uses a sling to throw back a tear gas canister fired by Israeli troops during clashes outside Israel’s Ofer military prison near the West Bank city of Ramallah on Feb. 25. (Mohamad Torokman/Reuters)

Put on the defensive by the recent deaths of two Palestinians in custody, Israeli authorities opened the gates of a West Bank prison on Sunday to foreign reporters, providing a rare, though controlled, look at conditions behind bars.

The prisoner deaths, along with prolonged hunger strikes by several other inmates, set off a wave of street protests in the West Bank in recent weeks, raising concerns in Israel of a slide toward a third Palestinian uprising.

Palestinian officials accused Israeli authorities of medical negligence in the death of one prisoner, who succumbed to cancer this month, and they alleged torture in the case of another who died in February while under interrogation by Israel’s Shin Bet security service. Israeli officials have denied the accusations and say the causes of both deaths are under investigation.

Seeking to rebut the Palestinian allegations, Israel’s Government Press Office took the unusual step of inviting reporters for an inside look at the Ofer Prison, a facility near Ramallah that houses about 700 inmates, most of them detainees held pending trial or for the duration of legal proceedings.

“We have nothing to hide,” said Yaakov Shalom, the prison warden, a 25-year veteran of the Israel Prison Service, whose facilities hold about 5,000 Palestinians.

A hulking walled complex surrounded by barbed wire and watchtowers, the prison holds inmates in sections divided according to their membership in Palestinian factions: Fatah, Hamas, Islamic Jihad and smaller militant groups. A separate section is reserved for teenagers younger than 18.

In one sunlit prison yard surrounded by a latticework of metal bars, Hamas prisoners knelt in prayer and milled about outside their cells. Abdul Kahir Srour, from Ramallah, said he had been held without charge for five months for alleged activities on behalf of Hamas. He said treatment “fluctuated” in response to conditions in the prison and the political atmosphere outside.

When detainees refused meals to protest the death of the prisoner this month, Srour said, they were confined to their cells and denied family visits. Shalom, the prison warden, said that refusing food was a violation of prison discipline and that punishment included confinement to cells.

The death of the prisoner from cancer drew accusations by Palestinian officials that the Israeli authorities had delayed proper treatment and a diagnosis for months, failing to promptly refer the inmate to a hospital specialist.

Shalom would not comment about the case, which happened in another jail and is under review by the prison service, but he said that doctors saw prisoners at Ofer five days a week. He said that although there had been complaints of delays in referral for hospital treatment, waiting time could be shortened in urgent cases at the recommendation of prison doctors.

In the Hamas section, Muhammad Natsheh, a member of the Palestinian parliament from ­Hebron, complained that he had been trying for four months to get a referral to a specialist for a medical problem, without success. But a medic in an adjacent clinic said that such referrals were provided when necessary. “There is no neglect,” he said.

In a separate section holding about 100 minors, two teenagers were playing table tennis in the yard, and a group sat in a room where a video of “The Smurfs” was playing on a flat-screen TV mounted on the wall.

Their stories were a checklist of the daily confrontations that punctuate the festering conflict in the West Bank.

Tarek Hamed, 17, from the village of Silwad near Ramallah, said he had been arrested at 1:30 a.m. in his home for throwing stones earlier at a nearby highway used by Jewish settlers. He said that because he had been beaten by soldiers after his arrest, a military court gave him a one-month sentence instead of the five demanded by the prosecution.

A friend, Yousef Hamed, 15, said he was given four months and fined the equivalent of $550 for a similar offense. Mohammed Safi, 17, said he was serving a six-month stint for hurling stones at soldiers at a checkpoint. He, too, said that he was slapped around when he was arrested and interrogated, but that he had not been touched at the Ofer facility.

The recent West Bank unrest has led to an increase in stone-throwing at army posts and at Israeli motorists, and in one incident last month, a 3-year-old girl from a settlement was critically wounded.

Shalom, who said he meets regularly with prisoner leaders to hear their requests, said his policies toward the inmates were not influenced by events outside the prison walls.

“As long as they don’t create disturbances, it doesn’t matter what’s going on outside,” he said. “They have a lot to lose, and it’s worth it for them to behave accordingly.”

William Booth contributed to this report.