The remains of the Spanish dictator Francisco Franco will be exhumed from the state mausoleum where they have lain since his death in 1975 within the next two weeks, the government has announced.

Disinterring Franco from his tomb in the Valley of the Fallen near Madrid has been one of the key promises of Spain’s ruling socialist party, the PSOE, since it came to power in June last year. However, its efforts have been bitterly opposed by the dictator’s family.

At the end of September, the supreme court ruled that Franco’s body could be removed and reinterred in the Mingorrubio municipal cemetery outside Madrid where his wife, Carmen Polo, is buried.

Speaking after a weekly cabinet meeting, the acting deputy prime minister, Carmen Calvo, said the dictator’s remains would be exhumed by 25 October. She said the Franco family would be given 48 hours’ notice of the removal and reburial in case they wished to be present.

Calvo said the body of Franco, who she said was “the author of a dark chapter of the country’s past”, would be treated with the “absolute respect” that all human remains deserved.

The socialist party, led by the acting prime minister, Pedro Sánchez, has long argued that the basilica and its 150-metre (490ft) cross are a monument to the Franco regime that glorifies the winners of the civil war rather than commemorating its 500,000 victims.

The Valley of the Fallen, which was partly built by captured republicans and political prisoners, is a mass grave containing the remains of more than 30,000 people who fought on either side of the war.

Only two graves are marked – those of Franco and José Antonio Primo de Rivera, the founder of the Falangist party.

Calvo said legal appeals from the Franco family had delayed the exhumation, which was scheduled originally for 10 June, and the government was pleased finally to be able to “put a dignified end to something undignified” after more than 40 years.

“We want [the valley] to be a place dedicated exclusively to peace and forgiveness and a place of justice for all those who were victims of an atrocious war,” she said.

The site will be closed to visitors from Saturday to allow the exhumation preparations to begin and to keep it clear of protesters.

The government wanted to complete the exhumation before campaigning begins for Spain’s general election on 10 November. The country is returning to the polls for the fourth time in as many years after Sánchez’s party won the most votes in April’s election but fell short of a majority and was unable to form a stable government.