CAIRO, Mar. 6 (Reuters) - The U.S. said on Wednesday that talks on a ceasefire and release of hostages in Gaza could still reach an agreement between Hamas and Israel as the enclave's humanitarian crisis prompted South Africa to ask the World Court for new emergency measures.

Negotiators from Hamas militants, Qatar and Egypt - but not Israel - are trying to secure a 40-day ceasefire in time for the Muslim fasting month of Ramadan, which begins early next week.

Despite speculation negotiations were at an impasse, the U.S. said on Wednesday that a truce accord was still possible.

"We continue to believe that obstacles are not insurmountable and a deal can be reached ... so we're going to continue to push for one," U.S. State Department spokesperson Matthew Miller said in Washington.

But South Africa, which in January brought a case at the World Court in The Hague accusing Israel of genocide in Gaza, on Wednesday asked the court to order new emergency measures including a stop to hostilities because Palestinian civilians were facing starvation.

"The threat of all-out famine has now materialised. The court needs to act now to stop the imminent tragedy," the South African presidency said in a statement.

The Gaza health ministry said two Palestinians, aged 15 and 72, died of dehydration and malnutrition in Al Shifa and Kamal Adwan hospitals on Wednesday, raising the toll of such deaths in just over a week to 20. Reuters could not verify the deaths.

Fears were also mounting that the Gaza conflict could spread in the Middle East, especially after a series of attacks on vessels in the Red Sea and Gulf of Aden by Iran-aligned Houthi forces acting in solidarity with the Palestinians.

In the latest strike, at least three sailors were killed in a Houthi attack on a Greek-owned freighter, U.S. military officials said, the first deaths reported since the Yemeni group began the strikes against shipping in one of the world's busiest sea lanes.

The U.S. State Department said it would continue to hold the Houthis accountable for such attacks.

Photo from Reuters