At least 45 tax-exempt charitable groups funneled some of the donations for their “worthy” causes into the campaign coffers of political parties and candidates — an illegal practice that could jeopardize their tax-exempt status with the IRS, a Post review of two years of campaign filings shows.

The charitable groups’ combined contributions to the pols totaled about $70,000, according to records filed with the state Board of Elections.

In one transaction, the charitable foundation of “Sex in the City’’ actress Cynthia Nixon and her wife, Christine Marinoni, donated $5,000 to the Working Families Party last August. The WFP called the donation a “bookkeeping error.”

“The contribution was immediately returned and replaced by a personal check. End of story,” said Working Families Party director Bill Lipton.

Other culprits included more than a dozen churches that put money behind candidates or political groups.

For example, the campaign of Bronx District Attorney Darcel Clark accepted a $150 contribution on Oct. 30, 2015, from St. Luke’s Episcopal Church.

The treasurer for Clark’s campaign, Carl Lucas, said he goofed by depositing the contribution, and refunded the money in February 2016.

“It was my fault for taking it,” Lucas said.

Pastor Leroy Pascall of the Springfield Gardens Church of the Nazarene admitted he directed a $200 church donation to the campaign of state Sen. James Sanders last year.

Pascall said he was told the donation was OK.

“I wouldn’t violate the law. I will check that out,” Pascall said.

As for the Church of Nazarene’s donation, Sanders spokeswoman Annmarie Costella said, “the campaign treasurer has been informed and if it turns out to be true the donation will be refunded.”

In total, more than a dozen churches steered $4,900 to political campaigns.

President Trump is seeking to ease the prohibition on political advocacy by tax-exempt religious groups.

Watchdog groups have cried foul.

“These donations are completely and totally illegal,” said John Kaehny, director of Reinvent Albany. “The state attorney general and IRS should be looking into this.”

There were 28 different tax-exempt foundations recorded as contributing about $60,000 to candidates or partisan groups.

The National Police Defense Foundation donated $750 to the Nassau County Conservative Party in March, records show.

The foundation’s president, Joseph Occhipinti, said the money bought tickets for a Conservative Party event. He claimed the donation was appropriate and his group has given to Nassau Conservatives since 2008.