The Spanish Supreme Court ruled Tuesday that the caretaker Socialist government can exhume the remains of former dictator Gen. Francisco Franco from the gigantic mausoleum he built on the outskirts of Madrid, seemingly settling a decades-old controversy.

Six judges unanimously rejected an appeal by Franco's relatives against the government's plan to move the body to a cemetery on the capital's outskirts.

Leftist parties and families of many Spanish Civil War victims have wanted Franco, who died in 1975, to be removed from the Valley of the Fallen mausoleum, a major tourist attraction. Others have argued it would open old wounds.

Some 34,000 people from both sides in the 1936-39 civil war are also buried there, most of them never identified.

UN APOLOGIZES TO SPAIN FOR MISCHARACTERIZING BOMBINB THAT INSPIRED FAMOUS PICASSO PAINTING

Tourists visit the Valley of the Fallen mausoleum near El Escorial, outskirts of Madrid, Spain, Tuesday, Sept. 24, 2019.

Tourists visit the Valley of the Fallen mausoleum near El Escorial, outskirts of Madrid, Spain, Tuesday, Sept. 24, 2019. (AP)

Franco's family had hoped to block the exhumation or at least have the body reburied in central Madrid's Almudena Cathedral, an idea vehemently opposed by the government.

The ruling came as Spain's parliament was dissolved and elections officially set for Nov. 10; opposition parties have accused the Socialists of planning to use the exhumation for electoral purposes.

The ruling can't be appealed but lawyer Luis Felipe Utrera said the dictator's relatives intended to take "the legal battle to the end" by going to the country's Constitutional Court and the European Court of Human Rights.

SPAIN BREAKS UP HUGE DRUG RING BUT 'MESSI OF HASHISH' STILL ON THE RUN

"The government is prohibiting a family from burying where they deem convenient," Utrera told Spanish public broadcaster TVE.

Such legal challenges would not immediately stop the Socialist executive's plans.

Caretaker Prime Minister Pedro Sanchez celebrated the decision in a tweet: "The determination to make up for the suffering of the victims of Francoism has always guided the government's action," he wrote.

Protesters shout behind a banner showing photos of Spanish Civil War victims, outside the Supreme Court in Madrid, Spain, Tuesday, Sept. 24, 2019. 

Protesters shout behind a banner showing photos of Spanish Civil War victims, outside the Supreme Court in Madrid, Spain, Tuesday, Sept. 24, 2019.  (AP)

His deputy, Carmen Calvo, said the government intended to proceed with the exhumation "as soon as possible."

Bonifacio Sanchez, spokesman for Spain's Association of Historical Memory, which has long fought for the body's removal, said he welcomed the decision but opposed the government plan to take it to the El Pardo cemetery outside Madrid.

The cemetery is a publicly financed place and the remains should be given to the family for burial in a private location, he said.

He also dismissed the Franco's family's plans to appeal, saying that "the state cannot be dependent on what the family of one that has committed genocide says."

CLICK HERE FOR THE FOX NEWS APP

Experts have estimated 114,000 bodies from the civil war are still buried in 2,500 mass graves across the country, most of them unmarked.