For an American president, turning up in a warzone is an extraordinary move.

Joe Biden’s trip to the Middle East on Wednesday was always going to be a high-stakes gamble.

But he is now flying into an even more volatile situation, after the bombing of a hospital in Gaza that is thought to have killed hundreds of Palestinians.

Hamas has blamed an Israeli air strike, but Israel said the blast at Al Ahli hospital was caused by rockets fired by Palestinian Islamic Jihad.

Mr Biden had planned to meet Israeli Prime Minister Benjamin Netanyahu in Tel Aviv and Arab leaders in Jordan.

But just before Air Force One took off from Joint Base Andrews, the summit in Amman was suddenly cancelled.

President Biden will have wanted to look like an honest broker dealing with both sides in the Middle East.

He now faces the embarrassment of being told by the leaders of Jordan, Egypt and the Palestinian Authority that they have no confidence in his ability to end the violence, which they say is in breach of international law.

There is no doubt whose side President Biden is on when it comes to the conflict between Israel and Hamas.

The president described the Hamas attacks on Israel on 7 October – which left more than 1,400 Israelis dead – as “sheer evil”, and said the country had a right and a duty to defend itself.

His hastily organised visit is designed to further demonstrate America’s firm solidarity with the Jewish state.

But he is having to balance his support for Israel’s aim of destroying Hamas with his deep concerns about the civilian and humanitarian cost.

And while he has publicly warned of the need to operate by the “rules of war”, the message he delivers behind closed doors could be more stern.

White House National Security Council spokesman John Kirby said the US and Israel stood for the rule of law, “unlike Hamas”.

“This is a foundational element of the discussions we’ve had with the Israelis forever, and we will continue doing that,” he said.

The US wants Israel to allow aid into Gaza, and for it to allow safe passage for trapped Americans in Gaza.

After nearly eight hours of talks with Mr Netanyahu on Monday, Secretary of State Antony Blinken said he had made good progress towards these goals, yet still nothing has been agreed.

President Biden is also crucially aware that global public sentiment could quickly change, and support for Israel might evaporate when overwhelmed by images of Palestinian casualties and suffering.

There is also a very real fear that the more brutal the assault on Gaza, the greater the chance that it could trigger a wider conflict in the region with other countries getting involved.

Then there are inevitable security concerns.

The apparatus that accompanies the president abroad is formidable at the best of times, and a short-notice trip to a conflict zone will be a considerable challenge.

Mr Blinken and his entourage were forced to seek shelter in a bunker as air raid sirens sounded in Tel Aviv on Monday – that would be a difficult look for a president.

This could be one situation in which Mr Biden’s age becomes an advantage not a problem.

He has been visiting Israel for 50 years, and he has known Mr Netanyahu for 40 years, describing theirs as a “frank relationship”.

That will allow for a more robust exchange of views than those that can be shared between leaders who don’t have that kind of personal history.

President Biden has clear ideas about what he believes should and should not happen next.

He thinks it would be a mistake for Israel to occupy Gaza.

He has said there needs to be a Palestinian Authority and a path to a Palestinian state, even though there has been no progress towards Palestinian statehood for many years.

He will surely want to put the maximum pressure he can on Israel to operate more carefully in Gaza, and to end the conflict as quickly as possible.

The US has consistently been Israel’s most loyal and committed ally.

Regardless of who is in the White House, there has always been broad support for the Jewish state and its right to exist in safety and security.

President Biden has for decades been one of the politicians most outspoken in his backing for Israel, saying in 1986 that “were there not an Israel, the United States of America would have to invent an Israel to protect our interests in the region”.

Now it is time for the US president to use all the influence and leverage he has at his disposal to try to limit the bloodshed and loss of life, and prevent an all-out war across the Middle East.

All while events on the ground are making it harder than ever.