Spain’s Supreme Court on Tuesday gave the government the green light to exhume the remains of right-wing dictator Gen. Francisco Franco from a grandiose mausoleum he built outside Madrid.

In a unanimous ruling in favor of the caretaker Socialist government, the six judges decided “to completely reject the appeal lodged by the family in relation to Francisco Franco’s exhumation.”

Franco — who ruled with an iron fist following the end of the 1936-39 civil war and died in 1975 — is buried in a stately basilica partially built by his political prisoners and carved into a mountain in the Valley of the Fallen.

The site has been a major attraction for tourists and far-right sympathizers who rally at it on the anniversary of Franco’s death on Nov. 20.

Tuesday’s ruling should allow the government of Socialist Pedro Sanchez to go ahead with its plans to move the remains to the family tomb at Mingorrubio El Pardo, a state cemetery on the outskirts of Madrid.

“Today is a great victory for Spanish democracy,” Sanchez wrote on Twitter, saying his government was determined “to redress the suffering of victims of Francoism.”

The Socialists have long sought to turn the Valley of the Fallen complex into a memorial to victims of the civil war, in which about 500,000 people were killed.

About 34,000 civil war dead are buried there, including many who fought for the losing Republican side and whose bodies were transferred to the site during Franco’s dictatorship without their families’ permission, according to Reuters.

Franco’s relatives had appealed both against exhuming his remains and against the government’s plans to move them to the El Pardo cemetery.

Were his remains to be moved, they wanted them to be taken to the Almudena Roman Catholic Cathedral adjacent to the Royal Palace in central Madrid, alongside his daughter.

In December, a government report said the Almudena cathedral was unsuitable as a burial place for security reasons.

“I hope the judges deliver justice … justice over a murderer who killed so many,” 79-year-old Jose Lopez, whose father lost a brother in the civil war, said tearfully outside the Supreme Court before the ruling was announced.

With Post wires