A Spanish court on Wednesday ordered Francisco Franco's family to hand over the keys to a mansion it says was illegally bought by the late dictator decades ago.

The Pazo de Meiras estate in the northwestern Galicia region, which was used by Franco as a summer residence, currently belongs to six of his grandchildren.

But a court in the Galician city of Coruna ordered them to turn it over to state ownership, upholding a Spanish government complaint filed last year claiming the 1941 sale of the property was "fraudulent".

The family has always claimed the historic mansion, which was built between 1893 and 1907, was private property.

The estate was acquired by a Francoist organisation during the civil war (1936-1939) and later signed over to the victorious dictator.

But the court took issue with the donation in 1938 and subsequent sale in 1941, ruling it "null and "void", since it was transferred to "the head of state and not to Francisco Franco personally".

It also found that the sale was little more than a "pretence" given that "Franco did not pay anything" for it.

Franco's family has always claimed the historic mansion in Galicia was private property
Franco's family has always claimed the historic mansion in Galicia was private property AFP / MIGUEL RIOPA

As a result, it ordered Franco's family "to immediately hand over the property without being compensated for the expenses they claim to have incurred for its maintenance".

"On accepting that the country estate belongs to the state, the judge also declared null and void the transfer of the property to Franco's heirs" following his death in 1975, a court statement said.

The family now has 20 days to appeal.

In 2018, Galicia's regional government declared the 19th-century mansion to be of "historic and cultural value", ordering the family to open it up to the public.

But they fiercely opposed the move, arguing it was private property.

Wednesday's ruling is a new setback for the Franco family who last year failed to stop the dictator's exhumation from a grandiose Catholic mausoleum near Madrid.

Franco ruled Spain with an iron fist from 1939 until his death in 1975 when he was buried inside the vast basilica at Valley of the Fallen, but last October his remains were transferred to a discreet family plot in El Pardo cemetery, on the outskirts of Madrid.