A 500-year-old secret code used in letters between one of Spain's most famous monarchs and a military commander has been cracked.

Ferdinand of Aragon's letters have tantalised historians for centuries.

Constructed using more than 200 special characters, they were deciphered by the country's intelligence agency.

He was behind the final recapture - Reconquista - of Spain from the Moors in 1492 and Columbus's journeys to the Americas.

The letters between Ferdinand and Gonzalo de Córdoba include instructions on strategy during military campaigns in Italy in the early 16th Century. They were written using secret code in case they fell into enemy hands.

The letters are on display at Spain's Army Museum in Toledo and it took intelligence services almost half a year to decipher four of them, some of which went on for over 20 pages.

The code-cracking has been described by some as a "Rosetta Stone" moment, amid hopes that it could lead to more coded letters being deciphered.

Details outlined in the letters range from instructions on troop deployments to admonishing the commander for not consulting the king before launching diplomatic initiatives.

In the early 16th Century, it would have taken 15 days for the letters to get between the monarch's residences to south-eastern Italy where the commander was based.

What the code looked like

The mysterious coding system used by Ferdinand of Aragon and Gonzalo de Córdoba was highly complex. It was constructed using 88 different symbols and 237 combined letters.

For each letter there were between two and six figurative characters such as triangles or numbers.

To complicate matters even further, the symbols used in the letters were written without separating words and phrases.

Who was fighting whom?

At the start of the 16th Century, Spain and France battled for control of the Mediterranean.

Between 1499 and 1504, the fight centred on the Kingdom of Naples.

Spain wrested control of Naples from France in 1504 and ruled it until 1647.