Spain will probe "human rights violations in Gaza" to assist the International Criminal Court, which has sought arrest warrants for Israeli officials over alleged war crimes, the attorney general has said.
A statement said the attorney general had "issued a decree to create a working team tasked with investigating violations of international human rights law in Gaza" to "gather evidence and make it available to the competent body, thereby fulfilling Spain's obligations regarding international cooperation and human rights".
It comes as the UN investigator, who this week accused Israel of committing genocide in Gaza, said she sees parallels with the butchery in Rwanda, and that she hopes one day Israeli leaders will be put behind bars.
Navi Pillay, a South African former judge who headed the international tribunal for the 1994 Rwanda genocide and also served as UN human rights chief, acknowledged that justice "is a slow process".
But as late South African anti-apartheid icon Nelson "Mandela said, it always seems impossible until it's done", she told AFP in an interview.
"I consider it not impossible that there will be arrests and trials" in the future.
Ms Pillay's Independent International Commission of Inquiry (COI), which does not speak on behalf of the United Nations, issued a bombshell report on Tuesday concluding that "genocide is occurring in Gaza" - something Israel vehemently denies.
The investigators also concluded that Israeli President Isaac Herzog, Prime Minister Benjamin Netanyahu and former defence minister Yoav Gallant have "incited the commission of genocide".
Israel categorically rejected the findings and slammed the report as "distorted and false".
But for Pillay, the parallels to Rwanda - where some 800,000 people, mostly ethnic Tutsis and moderate Hutus, were slaughtered - are clear.
As head of the International Criminal Tribunal for Rwanda, she says watching footage of civilians being killed and tortured had marked her "for life".
"I see similarities" to what is happening in Gaza, she said, pointing to "the same kind of methods".
While Tutsis were targeted in Rwanda's genocide, she said "all the evidence (indicates) it is Palestinians as a group that is being targeted" in Gaza.
Israeli leaders, she said, had made statements, including calling Palestinians "animals", which recalled the demonising rhetoric used during the Rwanda genocide, when Tutsis were labelled as "cockroaches".
In both cases, she said the target population is "dehumanised", signalling that "it's ok to kill them".
The International Criminal Court has already issued arrest warrants for Benjamin Netanyahu and Yoav Gallant for suspected war crimes.
Ms Pillay said securing accountability would not be easy, highlighting that the ICC "does not have its own sheriff or police force to do the arrests".
But she stressed that popular demand could bring about sudden change, as it had in her home country.
"I never thought apartheid will end in my lifetime," she said.
Ms Pillay said that going forward, the commission aims to draft a list of suspected perpetrators of abuses in Gaza, and also explore the suspected "complicity" of countries supporting Israel.
That work will meanwhile be left to her successor, since Ms Pillay will be leaving the commission in November, citing her age and health concerns.
Before that, she said she had her visa ready to travel to New York to present her report to the UN General Assembly.
So far, she said, "I have heard nothing about that visa being withdrawn".
Read Latest Middle East stories