Cold and capricious as Ferdinand was sometimes toward the cardinal, he treated him with the same respect as ever when his own interests or those of the state seemed to require it. When he had espoused the cause of Julius II. against the King of France, he sent for Ximenes to meet him at Seville and aid him with his counsels. It was in the depth of winter, but the cardinal promptly obeyed the summons. He admired the bold attitude assumed by the pope, and heartily sympathized with his efforts to recover the territories which had been torn from the Church, to extend the temporal sovereignty of the successor of St. Peter, to compel his vassals to obey him, and to humble the power of Venice, then mistress of almost all his seaports. He saw with satisfaction the blows inflicted on the pride and insolence of the Baglionis and Bentivoglios, and he approved of the League of Cambray, by which Julius II., Louis XII., the Emperor of Germany, and the King of Spain bound themselves to enfeeble Venice and avenge the injuries she had done to the domains of the Church. But Ximenes, though he concurred in the papal policy as regards Venice, shared also the fears of the sovereign pontiff lest France should extend her possessions in the north of Italy. He justified Julius II. in withdrawing from the League into which he had entered, and was prepared to afford him every assistance in resisting the arrogance of Louis XII. when he seized on Bologna and convened a council at Pisa, in defiance of the Holy See. The adhesion of Ferdinand and Ximenes encouraged Pope Julius to form an alliance with Venice, and thus to oppose the united forces of the Emperor Maximilian and Louis XII. Under the auspices of these princes a schismatical council dared to assemble at Pisa, and afterward at Milan. Seven insubordinate cardinals and twenty bishops, chiefly French, were present at the opening, and in the eighth and ninth sessions they audaciously declared Julius II. deposed. But a general council, convened by the pope, met in the Lateran in 1512, condemned these schismatical proceedings, and restored the wavering to obedience. Even Maximilian deserted the King of France, and Henry VIII. of England sided with Ferdinand against the pope's enemies.

It may here be mentioned that Ximenes was averse to the distribution of indulgences under Julius II. and Leo X. for the completion of St. Peter's in Rome. The ground on which he disapproved of it was, that the relaxation of temporal punishment which these indulgences conferred might weaken and disturb ecclesiastical discipline. Devoutly submissive as he was to the Holy See, he nevertheless, as Gomez relates, advised Ferdinand to enact a law by which all papal bulls should, before publication, be submitted to a minister of state. His object was to guard against abuses, since dispensations were often obtained too easily from Rome.

During Ferdinand's last illness, Ximenes occupied a prominent post in the affairs of state; and on one occasion, when the sovereign was absent from Castile, the government was entrusted to him, in concert with the royal council. It was, therefore, natural that, when the king died, he should be appointed regent during the minority of Charles V. Ferdinand had, it is true, objected to him as too austere, but he yielded to the advice of others, and consented to the appointment immediately before receiving the last sacraments. It was, he thought, an advantage in his case not to have been born of a noble family, since he could on that account conduct the administration with greater impartiality. Thus, on the 23d of January, 1516, Ximenes became once more the ruler of a nation daily rising in importance.

Another claimant of supreme power appeared on the scene. This was Dean Hadrian, afterward pope, who had been tutor to Prince Charles, and who produced a document signed by the prince, authorizing him to assume the regency of Castile in the event of Ferdinand's demise. The legal decision on the question was unfavorable to Hadrian's claim; but Ximenes, wishing to avoid disputes, consented to rule conjointly with his rival until Charles himself should decide by which of the two he would be represented. Nothing could exceed the promptitude and energy of the cardinal's measures. If an insurrection broke out, troops were despatched instantly to suppress it. Madrid was in the neighborhood of his own vassals, and he therefore chose it as the seat of government, lest he might in some other place be exposed to the violence of interfering grandees.

The authority given in the first instance to Ximenes was fully confirmed by Charles, and in a letter which he addressed to the cardinal he declared that "the most excellent clause he had found in his grandfather's will was that by which Ximenes was invested with the government of the kingdom and the administration of justice." The fame of the consummate wisdom, experience, and eminent virtues of the cardinal had reached, he said, even Flanders; and he therefore enjoined on all the members of his family, the nobles and prelates, to recognize him as regent. To Hadrian the prince assigned a subordinate post, and every arrangement was made with due regard to the rights of the unhappy Queen Joanna, whose derangement made her practically a cipher, though nominally supreme ruler. Her name preceded that of her son Charles in all public documents; but the prince was proclaimed King of Castile by order of Ximenes. It was not until Charles arrived in Spain that the Cortes of Aragon consented to recognize his title as king of that country also.

The height of power is generally the height of discomfort. Many of the nobles combined to harass Ximenes, and incite the people to rebel against "a monk of base extraction." They questioned his authority, and decided on sending messengers to Flanders to demand his dismissal. The cardinal, however, was fully apprised of all their plans; and it is said by Gomez that, when some of them waited on him to ask for the documents in virtue of which he held the regency, he took them to the window, and showing them a park of artillery, said, "These are the powers by which I govern Castile according to the king's will and command."

He took, indeed, if Peter Martyr can be credited, great interest and pleasure in military affairs. He had heard Ferdinand expatiate on the advantages of a militia as opposed to an army recruited from different countries; and now that he was wielding dictatorial power, he resolved to put the scheme in execution. He conferred with the senate, and issued a proclamation inviting the enlistment of volunteers. They were, with the exception of officers and musicians, to serve without pay, but in return they were exempted from taxes, socages, and all other charges. Immediate success attended this measure. Thirty thousand citizens were speedily enrolled, and were daily drilled in public. The compliments paid to Ximenes by ambassadors, and the envious cavillings of foreign princes, sufficiently proved the wisdom of this organization. It encountered great opposition from the nobles, but, being endorsed by the special approval of Charles, it triumphed ultimately over every obstacle.

Ximenes's attention, at the same time, was turned to the maritime power of the kingdom. He added twenty trireme galleys to the navy, and put the entire fleet in movement against the Moors and pirates who infested the Spanish coasts. The seas were thus cleared of "Red Rovers," and Pope Leo X. congratulated the cardinal on the success of his marine administration. His government was assailed on all sides, but the great churchman was never at a loss. Whether he had to meet invading forces on the frontier, or suppress rebellion in the interior, he was in the highest degree prompt and resolute; he struck terror into his foes, and earned the absent sovereign's warmest gratitude. He was equally attentive to the details of government and to its general aims. He caused exact accounts to be drawn up of the revenues, finances, and laws of the three military orders; and was preparing similar documents relative to the kingdom at large when arrested in his labors by the hand of death. To relieve the royal treasury he suppressed numerous sinecures, beginning with those held by his own friends, and remonstrated with Charles on his lavish expenditure.