According to an old tradition, still accepted by a part of the populace of Madrid, an image of the Virgin of the Almudena, now in the possession of the nuns of the Sacramento Convent, was concealed by the zealous Christians, during the Moorish occupation, in a tower of the city wall. Three hundred years after the sacred image was discovered and restored to the Church. There is a similar legend concerning the sculpture of the Holy Mother found at about the same date.

Upon the victory of Alfonso, the mosque was purified and dedicated to the Vírgen de la Almudena, and on the site is the fine new Cathedral. A mixed population of Christians, Jews, and Moors lived within the city walls at this period, and the staple industries were the making of hemp, linen, and cloth. One of the regulations of that day referred to the muzzling of dogs, as may be seen from an inspection of the curious Fuero de Madrid, which is preserved by the municipal authorities.

The city is mentioned only occasionally in Castilian annals. Sancho el Bravo in vain sought health and strength from its bracing air.

Under Ferdinand IV. the Cortes first assembled in Madrid, to meet there again in 1335 under Alfonso XI. The townsmen warmly espoused the cause of Peter the Cruel. In 1403, Henry III. sent from the city an embassy to Persia, under Gonzalez Clavijo, to negotiate with the potent warrior sovereign Tamerlane. The emissaries were absent from Spain for two years, and during the journey they visited Constantinople and Samarkand.

John II. and Henry IV. lived in the Royal Palace, and encouraged many poets of Castile who were of their retinue. It is proved by municipal documents that Madrid was not then so insanitary and neglected as some writers have stated, for there were rules for the disposal of refuse, and an order was made for the paving of some of the chief streets.

Upon the death of Henry IV., a faction supporting his daughter, Juana (who is said to have been born here), seized the Alcázar, and held it for several weeks against the Duque del Infantado. Isabella, however, bore the town no grudge, and during her brilliant reign its prosperity increased by leaps and bounds. It remained loyal to the crown during the Comuneros rising, and was rewarded by a visit from Charles V. in 1524. He had taken a fever, and at the advice of his physicians, came to Madrid to regain health in this elevated, bracing region of Castile. A year after, he was in conflict with Francis I. of France, and the French king was a captive in Madrid. Attended by a few members of his Court, Francis occupied a room in the old palace, then known as the Alcázar. There is no doubt that he suffered keen humiliation during this detention, and that he was harassed by fears for the future. His gaoler was Alarcon, the valorous commander of the Spanish infantry, who appears to have treated his royal prisoner with courteous consideration.

When Francis heard that the Emperor desired that he should relinquish all claim to Italy and yield Burgundy, he seized his dagger, and swore that he would rather die than consent to the terms. And although Alarcon restrained him from plunging the dagger into his body, the King avowed that he would sooner suffer lifelong imprisonment than bear the disgrace of gaining freedom by the loss of power and dignity.

Lying on his bed, surrounded by counsellors, the French sovereign sank into a condition of fever and extreme depression. At length he declared his willingness to yield.

By the famous Treaty of Madrid, which was signed in 1526, Francis I. abandoned his rights over parts of Italy and certain portions of Holland and Belgium. The compact was solemnly celebrated at a religious service, and the French and Spanish monarchs passed a few days together before Francis crossed the frontier of Spain.

No sooner had he passed over the Bidassoa than Francis cried: “I am yet a king!” Never had he intended to keep to the terms of the Treaty of Madrid. His breach of faith alarmed Charles, who sent Lannoy and Alarcon to France as his emissaries. Their errand was unavailing; Francis offered a sum of money to the Emperor, but refused to cede Burgundy. And so the bitter feud between Charles and Francis was continued.