Ted Cruz wound up red-faced after he inadvertently cast a former porn star in one of his political ads, it was reported Thursday.

The God-fearing Republican Texas senator — who has heavily courted the religious right during his run for the White House — produced a 30-second spot featuring actress Amy Lindsay.

Lindsay, unbeknownst to him, is a skin-flick veteran who has appeared in such soft-core films as “Deviant Whores,” “Carnal Wishes” and “MILF.”

When it found out, the Cruz camp nixed the ad, titled “Conservatives Anonymous.”

It featured actors playing a group of dismayed former Marco Rubio supporters in a therapy session, according to BuzzFeed. Lindsay played the role of a member of that support group.

Lindsay — who said she is deciding between Cruz and Donald Trump — told BuzzFeed that she was under the impression that the campaign knew about her previous work.

She said she thought the inclusion of a person with such a diverse background would enhance Cruz’s stuffy image.

“It’s not just some old, white Christian bigot that people want to say, ‘It could be, maybe, a cool kind of open-minded woman like me,’ ” she told the site.

A spokesman for Cruz said the campaign was unaware of the actor’s past work in porn and took action when it learned of her full film history.

“The actress responded to an open casting call. She passed her audition and got the job,” spokesman Rick Tyler told BuzzFeed.

Lindsay later explained that there was some confusion and that the person who hired her was not briefed on the porn.

“I assumed that they knew, but none of the filmmakers or the casting director knew about my complete filmography in the past,” Lindsay told BuzzFeed.