MADRID, May 23 (Reuters) - At least seven police were injured in clashes with protesters, officials said, as tens of thousands ‌of people marched through Madrid on Saturday, demanding the ‌resignation of Prime Minister Pedro Sanchez after a series of corruption scandals.

A small group ​of protesters tried to break through barriers around Sanchez's residence during the rally which was otherwise largely peaceful.

Police detained a group of masked people on the main road approaching the Moncloa Palace, where the Socialist leader ‌lives with his family, ⁠images on Spanish television showed. Three people were arrested, police said.

Demonstrators carried banners marked with "Resignation of the socialist ⁠mafia" and other slogans, alongside scores of gold and red national flags in the "March for Dignity", organised by the Spanish Civil Society association.

Leaders ​from the ​opposition People's Party and the far-right ​Vox party also took part.

A ‌Spanish court announced on Tuesday that former Spanish Socialist prime minister Jose Luis Rodriguez Zapatero was being investigated for allegedly leading an influence-peddling and money-laundering network, in another blow to the leftist government.

Zapatero, a key ally of the current prime minister, denied any wrongdoing.

Sanchez briefly ‌considered resigning in April 2024 after a ​judge opened an investigation into his ​wife Begoña Gomez. He has ​publicly defended his family, saying the cases are ‌politically motivated and driven by far-right ​opponents.

She denies any ​wrongdoing and a Spanish prosecutor last month asked the investigating judge to close the case, which was brought by far-right groups.

Organizers ​said 80,000 people took ‌part in the protest. The Spanish government representative in Madrid ​put the number at about 40,000.

(Reporting by Graham Keeley, ​Michael Gore; Editing by Andrew Heavens)