Spain’s attorney general, José Manuel Maza, who was leading the prosecution of the separatist Catalan leaders, died on Saturday while in Argentina to attend an international law conference.

Mr. Maza, 66, died in a Buenos Aires hospital, shortly after saying he felt unwell. His death was confirmed by Spain’s justice minister, Rafael Catalá, and attributed to a kidney infection.

The sudden death of Mr. Maza deprives Spain of its top prosecutor as Prime Minister Mariano Rajoy is working to halt a secessionist movement in Catalonia and to get Spain’s judiciary to prosecute separatist leaders for illegally declaring the region’s independence.

Late last month, Mr. Maza began the prosecution of 20 Catalan politicians, including the region’s former leader, Carles Puigdemont. Mr. Maza said that they should stand trial for rebellion and sedition, as well as the misuse of public funds to organize an independence referendum.