‘We need a cease-fire,’ Biden says.

President Biden said Tuesday that talks on a possible six-week cease-fire in Gaza are “in the hands of Hamas right now.” He spoke just before a Hamas leader in Lebanon appeared to reject a proposed deal the United States is backing, insisting that Israeli hostages would be released only after a cease-fire was in place and Israeli forces have withdrawn.

Mr. Biden said that the Israelis had “been cooperating” in the indirect negotiations, which are being mediated by Qatar and Egypt, and that “a rational offer” had been made.

“We will know in a couple of days what’s going to happen,” Mr. Biden said as he returned to the White House from a weekend in Camp David, where he was preparing for his State of the Union speech, scheduled for Thursday. “We need a cease-fire.”

Mr. Biden’s remarks echoed comments made earlier in the day by Secretary of State Antony J. Blinken and on Monday by Vice President Kamala Harris regarding their meetings with a member of Israel’s war cabinet, Benny Gantz, who was in Washington on a visit that was not coordinated with the Israeli prime minister, Benjamin Netanyahu.

The urgency for a breakthrough in talks has grown as the Islamic holy month of Ramadan approaches, with all sides treating the holiday as a deadline. Ramadan, a month of prayer, introspection and dusk-to-dawn fasting, is the one of the most important times of the Muslim calendar. A continued Israeli military onslaught during the holiday could further inflame Arab-Israeli tensions.

The war is now approaching the five-month mark. Large parts of Gaza are in ruins, more than 30,000 people have been killed by the count of Gazan health officials, and severe hunger, bordering on starvation, is affecting hundreds of thousands.

Still, there was little sign Hamas, the armed group that governs Gaza, was ready to move toward a compromise. In Beirut, Lebanon, on Tuesday, a senior Hamas official, Osama Hamdan, repeated the group’s demand for a full Israeli withdrawal from Gaza and a permanent cease-fire in place before it would release Israeli hostages in exchange for Palestinian prisoners.

“The security and safety of our people will not be achieved except with a permanent cease-fire and withdrawal from every inch of the Gaza Strip,” Mr. Hamdan said. “A prisoner exchange cannot take place before all of this is achieved.”

Mr. Hamdan said that Hamas had made its position clear to the Qatari and Egyptian mediators.

At a meeting with Mr. Blinken, Qatar’s prime minister and foreign minister, Sheikh Mohammed bin Abdulrahman bin Jassim al-Thani, said that Qatar and its partners would persist “to make sure that this deal happens, despite whoever is trying to undermine the efforts of bringing peace.”

“We want to see an end of the humanitarian suffering; we want to see the hostages back with their families,” he said on Tuesday.

Before the Hamas news conference, Mr. Biden was asked whether a cease-fire was possible before the beginning of Ramadan, which has often been accompanied by heightened Israeli-Palestinian tensions over access to a major holy site in Jerusalem.

“There’s got to be a cease-fire,” Mr. Biden said, adding that if a deal is not reached by Ramadan to pause the fighting “it’s going to be very dangerous.”

He added, “So, we are trying very, very hard to get a cease-fire.”