Spain marked 40 years since a failed military coup Tuesday, but without the presence of former king Juan Carlos whose intervention helped stop the crisis, steering the nation toward democracy.

At a ceremony in parliament where the marks from bullets fired exactly four decades ago are still visible, Spain's King Felipe VI hailed those involved in halting the putsch that ultimately resulted in "the triumph of democracy".

"Forty years ago today, Spain experienced an extraordinarily serious attack on its democratic system," the king told parliament, hailing his father's intervention in a crisis that occurred when he himself was just 13 years old.

But Juan Carlos, who abdicated in 2014 and went into self-imposed exile last year due to growing questions over the origin of his fortune, was not at the ceremony, despite his central role in halting the coup.

Juan Carlos (left)  abdicated in 2014 and went into self-imposed exile last year due to growing questions over the origin of his fortune
Juan Carlos (left) abdicated in 2014 and went into self-imposed exile last year due to growing questions over the origin of his fortune AFP / OSCAR DEL POZO

For many Spaniards, memories remain fresh of that cold afternoon on February 23, 1981, when some 200 Guardia Civil officers loyal to the late dictator Francisco Franco, who died in 1975, stormed parliament, firing shots over the heads of MPs who were preparing to vote in a new government.

But the plan went awry due to the decisive response of Juan Carlos, with the king delivering a televised speech in uniform as commander-in-chief, calling on the armed forces not to support the coup and to respect the fledgling constitution.

The rebels surrendered at noon on February 24 and released the MPs they were holding hostage, less than a day after launching their attempted coup.

"King Juan Carlos I shouldered his responsibility and commitment to the constitution... (and) his firmness and authority were decisive for the defence and triumph of democracy," Felipe said.

"That night I was also a witness, although still a child, of that historic event and I learned the immense and incalculable value of freedom for the Spanish people."

King Felipe VI of Spain (L) and Spanish Prime Minister Pedro Sanchez (R) attend a ceremony marking the 40th anniversary of the February 23, 1981 failed military coup
King Felipe VI of Spain (L) and Spanish Prime Minister Pedro Sanchez (R) attend a ceremony marking the 40th anniversary of the February 23, 1981 failed military coup AFP / PIERRE-PHILIPPE MARCOU

In an editorial, El Mundo daily said that Juan Carlos' absence from the ceremony, "due to his own reprehensible mistakes, should not tarnish the brilliant role he played".

"He stopped the coup and democracy was strengthened to the point that it is one of the best in the West," it added.

The coup anniversary comes as divisions emerged within the ruling leftist coalition over the definition of democracy, with the hard-left Podemos saying Spain lacked "democratic normality" because of its jailing of Catalan separatist leaders over a failed 2017 independence bid.

Basque and Catalan separatists parties decided to boycott Tuesday's event, issuing a manifesto saying the failed coup was in fact a staged event by the Spanish state aimed at shackling real democracy.

In a manifesto, they called for a break from the political generation that emerged after Franco's death and for the real truth about the failed coup to be made public by declassifying official documents.

"As long as the state upholds the same political, legal and monarchical structures that existed 40 years ago, as long as it doesn't recognise the right to self-determination and has political prisoners, people in exile and repression, there will be no democratic normality, nor can the state be considered a full democracy," it said.

"These days, we see in the streets the social discontent, protest and weariness with these democratic shortcomings," it said referring to a wave of street protests after a rapper was jailed for controversial tweets.

"Real democratisation will only be possible by breaking with this legacy."