The European Central Bank on Wednesday sharply criticised Italy's surprise windfall tax on banks, warning it could weaken lenders' capital buffers and make them more vulnerable to future economic shocks.

Italy's hard-right government announced last month it would levy a one-time 40-percent tax on banks' "surplus profits" netted as a result of the ECB's series of interest rate hikes over the past year.

The shock move spooked investors and sent shares in Italian banks plunging before the government watered down the plan, saying the new tax would be capped at 0.1 percent of a bank's assets.

"Imposing an extraordinary tax on the banking sector could make it more difficult for credit institutions to build up additional capital buffers, as their retained earnings will be reduced, making them less resilient to economic shocks," the ECB said in a legal opinion.

The tax also does not take into account the long-term impact of higher borrowing costs, it said, which could lead to increased credit risks as households and businesses struggle to pay off more expensive loans.

The ECB said the windfall tax would hurt smaller banks in particular, as their income depends heavily on lending activity.

The Frankfurt institution also criticised the out-of-the-blue announcement of the special measure, saying it had created uncertainty that could spark legal issues and scare off future investors, potentially making it more costly for Italian lenders to attract funding.

It recommended that Italy carry out "a thorough analysis" of the windfall tax's "potential negative consequences for the banking sector".

The ECB's harsh assessment is similar to its criticism last year of Spain's windfall tax on banks. The ECB's opinion is non binding.

The Italian government has vowed to invest the proceeds from the tax into helping citizens cope with the rising cost of living, after the ECB's rate moves boosted banks' profits but increased the pain for borrowers.

Italian Prime Minister Giorgia Meloni has slammed the "unfair margins" of banks, and said the money raised would help "fund measures of support for households and businesses" struggling with record inflation.