It was an unholy mistake — that became one town’s miracle.

In 2012, an amateur art restorer in the small village of Borja, Spain, turned her attention to a fresco of Jesus Christ called “Ecce Homo” (“Behold the Man”). Alas, Cecilia Giménez’s “fix” rendered the face of Jesus — painted in 1930 by Elías García Martínez — wholly unrecognizable. Ecce Homo 2.0 became a global laughingstock, compared to a blurry potato and a monkey.

Tourists can’t get enough.

By 2016, more than 160,000 visitors flocked to the Sanctuary of Mercy church since the botched restoration, scooping up “Ecce Homo” souvenirs from pens ($2) to mugs ($7) to wine featuring Jesus’ tragically altered face on the label (approximately $4 to $11 a bottle).

The global curiosity has since led to a boom in tourism that’s allowed restaurants and museums in Borja, population 5,000, to remain stable during Spain’s crippling recession.

“The level of these numbers [of tourists] . . . has never happened before,” says Elena Aznar Martinez, who handles marketing for “Ecce Homo.”

“The visitors recognize me,” Giménez, 85, an amateur painter who had performed multiple church-sanctioned renovations of “Ecce Homo” over the years, tells The Post. “They take photos with [the painting] and with me . . . even though I tell them, ‘My children, I’m not an important person.’ ”

Visitors are charged 1 euro per person to enter the church for viewing, and all proceeds go to a church-affiliated nursing home. Fifty-one percent of the proceeds from souvenir sales go to the nursing home, while 49 percent go to Giménez, who uses the money to care for her 56-year-old son, José Antonio, who has cerebral palsy.

“When news broke [of ‘Ecce Homo’], I felt humiliated,” says Giménez. She claims she had only begun a part of the restoration before leaving on a vacation and intended to finish it upon her return, but was stopped by the church.

The painting’s since been found impossible to restore from its current state. At one point, García Martínez’s horrified heirs had threatened to sue Giménez for destroying the painting, but that never happened.

In March 2016, a museum dedicated to the fresco opened. And in August 2016, a comic opera, titled “Behold the Man” debuted in Borja.

“When I saw this photograph of [Giménez] in the paper, I felt so bad for her,” says Andrew Flack, who co-created the opera with fellow American Paul Fowler. Flack’s traveled twice to Borja and seen the painting. “I thought this had all the operatic qualities: faith, redemption and revenge.”

All the attention has even changed Giménez’s outlook.

“I’ve gone to a psychiatrist and I take medication to feel a bit better,” she says. “Now, I look [at the painting and think,] ‘It’s OK, you’re not that ugly,’ ” Giménez says. “I hold it so dear — to the point that I see him as handsome!”