Spain said on Thursday that it will join South Africa's case at the UN's top court in which Pretoria has accused Israel of "genocide" in the Gaza Strip.
"Our sole goal is to put an end to the war and to advance on the road of applying the two-state solution", Foreign Minister Jose Manuel Albares said at a press conference.
His statement came a week after Spain, along with Ireland and Norway, recognised the state of Palestine, sparking fury from Israel.
South Africa brought the case before the International Court of Justice last year, alleging that Israel's Gaza offensive, launched in retaliation for an unprecedented Hamas attack on Israel, breached the 1948 UN Genocide Convention.
Israel has strongly denied the accusation.
Set up after World War II, the Hague-based ICJ rules in disputes between states.
The ICJ on Friday ordered Israel to ensure "unimpeded access" to UN-mandated investigators to look into allegations of genocide.
In a ruling on January 26, the ICJ also ordered Israel to do everything it could to prevent acts of genocide during its military operation in Gaza.
But South Africa has since returned several times to the ICJ arguing that the dire humanitarian situation in the territory compels the court to issue further fresh emergency measures.
On May 24, the court ordered Israel to "immediately" halt its military offensive in the city of Rafah and keep open the key border crossing there for "unhindered" humanitarian aid.
It also called for the "unconditional" release of hostages taken by Palestinian group Hamas during its October 7 assault that sparked the war.
ICJ rulings are legally binding but the court has no concrete means to enforce them. For example, it ordered Russia to halt its invasion of Ukraine, to no avail.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Track Latest News Live on NDTV.com and get news updates from India and around the world