 In July 1906, aged 77, he became Prime Minister of Spain with a government supported by José Canalejas.The first months, he was also Minister of War.After a plot within his own party, led by Segismundo Moret, he was forced to resign after 5 months.