Spanish Prime Minister Mariano Rajoy has acknowledged that he made a mistake in his handling of a major corruption scandal in the ruling People's Party.

However, he has vigorously denied that he or other party leaders had received illegal payments.

Mr Rajoy made the comments at the start of a debate in parliament about the funding scandal.

It is the first time he has admitted any error since it came out in January that former People’s Party treasurer Luis Barcenas hid up to €48m in Swiss bank accounts.

Mr Barcenas, who left his post in 2009 but continued receiving financial support from the party, is in jail pending trial on charges of bribery, tax evasion and other crimes.

He told a judge he collected millions in cash donations from construction magnates and distributed them to senior party figures, including Mr Rajoy.

During the debate, Socialist leader Alfredo Perez Rubalcaba and other opposition leaders repeated demands that Mr Rajoy quit.

"Any other leader of a serious democracy in Europe would have stepped down over the SMS messages that you found perfectly acceptable. Can you imagine (German Chancellor Angela) Merkel texting a tax evader to tell him to 'be strong?" 

The prime minister said his error had been to trust Mr Barcenas, but made no other admission of wrongdoing.

"I was wrong. I'm sorry but that is how it was. I was wrong in trusting someone we now know didn't deserve it," he said.

Mr Rajoy has been criticised for maintaining contact with Mr Barcenas via text messages as recently as January.

The prime minister said he had always declared all his income to tax authorities and said a judicial investigation would prove that there was no illegal financing in the party.

He said all payments the party made to its employees, including expense accounts and seniority bonuses, were registered in official accounts.

Mr Rajoy acknowledged the scandal has damaged his, and his party's, credibility as well as Spain's image abroad at a time when the country is already battling painfully high unemployment, a shrinking economy and a massive budget gap.

The leader tried to deflect criticism over his refusal to address the scandal in parliament earlier, saying "we are facing a surprising and imaginative collection of lies, as time and justice will show".