Adnan agrees to start taking food immediately, after deal reached for his release from Israeli custody on 17 April

A Palestinian prisoner whose life was in danger after he refused food for 66 days agreed on Tuesday to end his hunger strike after a deal was struck for him to be released at the end of a four-month period of detention.

Khader Adnan, whose protest about being detained without charge attracted worldwide attention, will be freed on 17 April in an agreement that avoided Israel's supreme court having to scrutinise and rule on the validity of his imprisonment.

"There is a deal. [Adnan] will stop his hunger strike. They will not extend his administrative detention and he will be free on 17 April," said a spokeswoman for the Israeli justice ministry. The Palestinian prisoners' minister, Issa Qarage, confirmed the deal.

The agreement was reached less than an hour before the supreme court hearing was scheduled to begin. It had been brought forward by 48 hours amid fears that Adnan might die before the case could be heard.

Adnan, 33, a baker from a village near Jenin and a member of the militant group Islamic Jihad, began his hunger strike on 18 December in protest at alleged abuse during interrogation following his arrest a day earlier. An Israeli military court sentenced him to four months' "administrative detention", allowing the authorities to imprison him without charge and without having released to his lawyers any evidence against him.

A doctor who examined Adnan last week on behalf of Physicians for Human Rights said he had lost about one-third of his body weight and that his life was in danger although he was lucid. The prisoner was shackled to his hospital bed by both legs and one arm, the doctor reported.

Adnan's case focused attention on Israel's use of administrative detention orders against Palestinians. There are more than 300 prisoners held without charge in Israeli jails. Israel's supreme court has previously upheld the practice, backing the state's argument that it is necessary for security reasons and to protect its network of informants.

Adnan's hunger strike sparked solidarity protests across the West Bank and Gaza, and sympathy hunger strikes by other Palestinian prisoners.

Catherine Ashton, the EU foreign affairs chief, said at the weekend that Adnan's case was of "great concern".

"Detainees have the right to be informed about the charges underlying any detention and be subject to a fair trial," she said in a statement.

Israeli government spokesman Mark Regev defended the use of administrative detention orders, saying Adnan was "no boy scout". Other western countries used similar orders, he said in an interview with CNN.

According to the Israeli human rights group B'Tselem, "over the years, Israel has held thousands of Palestinians in administrative detention, for periods ranging from several months to several years".

Under international law, the measure can be used "only in the most exceptional cases, as the last means available for preventing danger that cannot be thwarted by less harmful means", it said.

Adnan, who is in an Israeli hospital, agreed to start taking food immediately, his lawyers said. Under the terms of the deal, his release is conditional on "no new additional substantial evidence" emerging before 17 April.