At least 12 people were killed and 75 injured when a UN facility sheltering civilians was struck in Khan Younis in southern Gaza, the UN's Palestinian refugee agency says.
UNRWA said two shells hit its Khan Younis Training Centre during fighting in the city's western outskirts.
Its commissioner condemned the "blatant disregard of basic rules of war".
Israel's military said it had ruled out that the incident was the result of an air or artillery strike by its forces.
It added that it was reviewing Israeli operations nearby and examining the possibility that it was "Hamas fire".
Israeli troops have been battling Hamas fighters as they advance into western Khan Younis, a day after the military said it had completely encircled the city.
Clashes and bombardment around the city's two main hospitals have also left thousands of patients, staff and others unable to leave.
The conflict was triggered by an unprecedented cross-border attack by Hamas gunmen on southern Israel on 7 October, in which about 1,300 people were killed and about 250 others taken hostage.
More than 25,700 people have been killed in Gaza since then, according to the territory's Hamas-run health ministry.
An estimated 1.7 million people - nearly three-quarters of the population - have also been displaced by the past 12 weeks of fighting and many of them are sheltering inside UN facilities or near them.
The Khan Younis Training Centre is one of the largest UNRWA shelters, with between 30,000 and 40,000 people said to be living inside its grounds.
UNRWA said the compound was clearly marked, that its co-ordinates had been shared with Israeli authorities, and that it and the civilians inside had to be protected under international law.
However, at least six displaced people were killed and many more injured when the training centre was struck on Monday during intense fighting in the surrounding area, according to the agency.
On Wednesday afternoon, UNRWA's Gaza director, Thomas White, said a building at the facility that was housing 800 people from northern Gaza was hit.
In an interview with the BBC from Rafah in the evening, he said the building was struck by "two tank rounds" and that at least nine people were killed.
On Thursday morning, Mr White issued a statement saying the building was "hit by two shells and caught fire". Twelve people had now been confirmed dead and 15 of the injured were in a critical condition, he added.
"A number of missions to assess the situation were denied. Yesterday evening, the UN finally managed to reach the affected areas to treat trauma patients, bring medical supplies and evacuate injured patients to Rafah."
He added: "The situation in Khan Younis underscores a consistent failure to uphold the fundamental principles of international humanitarian law: distinction, proportionality and precautions in carrying out attacks. This is unacceptable and abhorrent and must stop."
In response to UNRWA's initial reports, the Israel Defense Forces (IDF) said: "After an examination of our operational systems, the IDF has currently ruled out that this incident is a result of an aerial or artillery strike by the IDF."
"A thorough review of the operations of the forces in the vicinity is under way," it added. "The IDF is also examining the possibility that the strike was a result of Hamas fire."
Vedant Patel of the US state department repeated Washington's calls for the protection of civilians in Gaza.
"We deplore today's attack on the UN's Khan Younis training centre," she said, and called it "incredibly concerning".
The IDF also said on Wednesday afternoon that its troops had "launched a divisional manoeuvre on West Khan Younis" that was targeting Hamas "outposts, infrastructure, and command and control centres".
"Dismantling Hamas' military framework in western Khan Yunis is the heart of the logic behind the operation."
The IDF added that Hamas "exploits the civilian population, exploits shelters and hospitals" - something the group has denied.
Gaza's health ministry meanwhile accused the IDF of "isolating hospitals in Khan Younis and carrying out massacres in the western area of the city".
The Palestine Red Crescent Society (PRCS) said the al-Amal Hospital, which it runs, and its local headquarters were under "siege" by Israeli forces, trapping patients, wounded people and an estimated 13,000 displaced people.
The organisation alleged that three displaced people were killed after being targeted at the entrance to the headquarters on Wednesday morning.
Médecins Sans Frontières (MSF) warned on Tuesday night that its staff inside the nearby Nasser Medical Complex - the largest hospital still partly functioning in Gaza - had reported bombing and heavy gunfire nearby.
"They are currently unable to evacuate along with the thousands of people in the hospital, including 850 patients, due to roads to and from the building being either inaccessible or too dangerous."
The IDF has issued evacuation orders for western parts of Khan Younis, including those where Nasser and al-Amal are located. The UN estimates there are about 88,000 residents and 425,000 displaced people in the area.
Mr White told the BBC that tens of thousands more people were now on the move, heading south to Rafah, on the border with Egypt, where as many as 1.4 million are already sheltering.
In another incident in Khan Younis on Tuesday, a cameraman for the UK's ITV News filmed a Palestinian civilian being shot dead on a main road about 1.7km (1 mile) south of the UNRWA shelter.
Five men are seen walking towards the combat zone holding a white flag, before there is a burst of gunfire and one of them falls to the ground. It was not clear who opened fire.
UK Prime Minister Rishi Sunak was asked in the Parliament on Wednesday whether such pictures would prompt him to push for a ceasefire in Gaza.
He replied: "No-one wants to see this conflict go on for a moment longer than is necessary and we do want to see an immediate and sustained humanitarian pause."
Efforts involving several countries to try to reach a ceasefire are ongoing, with one plan said to include a month-long truce and phased release of Israeli hostages and Palestinian prisoners.
But both Israel and Hamas appear to have rejected proposals, and hopes of any progress have been dampened.
Egypt's President, Abdul Fattah al-Sisi, meanwhile accused Israel of deliberately holding up aid deliveries at the Egyptian-controlled Rafah border crossing as "a form of pressure on the Gaza Strip and its people over the conflict and the release of hostages".
However, an Israeli defence ministry agency co-ordinating the deliveries with Egypt and the UN rejected the claim, insisting that "there is no limit to the amount of aid that can enter Gaza".