The two ex-leaders of New York’s Legislature tapped their campaign funds for a combined $3.6 million last year in an unsuccessful attempt to beat federal corruption charges, a practice that some lawmakers are trying to ban.

“When you get campaign dollars, people expect you to use them in campaigns,” said Sen. Andrea Stewart-Cousins, a Westchester Democrat. “It’s not expected to be used as get-out-of-jail-free funds.”

That’s not how it worked out for former Assembly Speaker Sheldon Silver and former Senate Majority Leader Dean Skelos. Both were convicted in separate federal corruption trials despite Silver spending $2.9 million and Skelos spending $760,000 on defense attorneys last year, according to campaign finance reports.

Manhattan Democratic Sen. Brad Hoylman has introduced a bill that would prohibit the use of campaign funds to pay attorney’s fees for defending against any civil or criminal lawsuit or federal or state criminal investigations. The sole exception would be for civil Election Law cases.

Hoylman’s bill, introduced a year ago, has seven co-sponsors and support of most members of the minority Senate Democratic Caucus. Citizens Union, Common Cause New York and the New York Public Interest Research Group all say it’s one of the reforms Albany needs.

Notably not supporting the measure is Gov. Andrew Cuomo, whose campaign spent $400,000 for lawyers representing him in the federal investigation of his abrupt shutdown in 2014 of the Moreland anti-corruption commission. U.S. Attorney Preet Bharara this month said their probe found “insufficient evidence to prove a federal crime.”

Spokesman Richard Azzopardi said the payments were for Cuomo’s fees and expenses concerning the law firm’s original engagement, as well as document production and assistance related to recent trials. Cuomo, talking to reporters in March, defended the practice, though he said paying legal fines and penalties would be a different matter.

“My father was governor for 12 years. He was sued for years after being governor,” Cuomo told reporters last year. “That is a function of being in office.”

“You vote for a bill as an assemblyman, they can sue you. You’re governor and the state takes an action — my father was sued by … people who were against abortion, and that he committed murder. So, you know, I believe it’s a function of the office and I believe it’s a legitimate fee.”

A separate Senate bill would prohibit state reimbursement to a campaign account for an official’s legal fees after an acquittal, a situation that came up in the case of former Senate Republican Majority Leader Joseph Bruno.

Bruno, convicted in 2009 of two corruption charges, had them overturned on appeal and was acquitted at a second trial. More than $1 million in campaign funds helped pay his lawyers. Last year, he was reimbursed $1.8 million by the state for legal fees. Some of that money — at least $355,000 — has come to the Senate Republican Campaign Committee and its housekeeping account through Creating New York Jobs Now, an organization Bruno created.

NYPIRG’s Blair Horner said the Legislature and governor last year codified some of the existing Board of Elections rules that generally prohibit using campaign funds for personal use. “They did not deal with legal defense funds,” he said.

Silver, a Manhattan Democrat who ruled the Assembly as speaker for almost 20 years, was convicted in November by a federal jury of awarding state medical research grants and influencing legislation helpful to New York City developers that brought him millions of dollars in legal fees. Skelos, a Long Island Republican who led the Senate as majority leader for four years, was convicted in December of using his influence to get his son lucrative no-show jobs.

Both are pursuing appeals. Silver’s lawyers on Thursday asked the trial judge to throw out his convictions, arguing the evidence didn’t prove he sold his influence.

Hoylman said if lawmakers knew they would have to pay out of their own pockets for their attorneys if they are accused of wrongdoing “maybe it would modify their behavior.”