Spain's High Court on Tuesday called on Prime Minister Mariano Rajoy to appear as a witness in a major graft trial involving members of his conservative Popular Party.
Rajoy had asked to testify by videoconference but the court ruled he must appear in person to answer questions.
He will testify at a court in San Fernando de Henares near Madrid on July 26.
The so-called Gurtel trial centres on a vast kickbacks scheme that allegedly helped finance his Popular Party (PP), which today has been weakened by repeated accusations of graft.
While Spain's 62-year-old leader is not accused of anything, his post as party chief since 2004 means he could provide valuable testimony.
Rajoy will become the first acting prime minister to appear in court as a witness since Spain's transition to democracy following dictator Francisco Franco's 1975 death.
Two former prime ministers -- Felipe Gonzalez, an ex-Socialist leader, and Adolfo Suarez, prime minister during the transition -- appeared on court in separate trials in 1998 after they were no longer in office.
The Gurtel case allegedly saw companies shower former PP lawmakers and civil servants with bribes in exchange for contracts.
Altogether, 37 defendants face justice including two former party treasurers and businessman Francisco Correa, the alleged head of the network.
The case even forced the resignation of Rajoy's health minister Ana Mato in 2014, accused of benefitting from illegally-obtained funds via her then husband who was mayor of the city of Pozuelo de Alarcon near Madrid.
According to a confession published by Correa in online daily eldiario.es, companies would give him a commission of two to three percent on the value of public contracts.
After taking his share, he would allegedly give politicians involved in awarding contracts some of the money too.
He also claimed he gave money to Luis Barcenas, the PP's manager and treasurer from the 1980s until 2009.
The fund is an ingredient of the current case but not the focus, as a separate trial on it is pending.