The actor and reformed Catholic served as emcee for the World Meeting of Families in Philadelphia, Pennsylvania, which was held to mark the Pontiff's first visit to the city.
Pope Francis and the 300,000-strong audience were treated to performances by artists like The Fray, rocker Juanes, opera star Andrea Bocelli and soul icon Aretha Franklin, but Wahlberg courted controversy as he made a cheeky comment about his work on the R-rated film.
After choirboy Bobby Hill received a hug from the movie star, Wahlberg praised the 14 year old's falsetto performance and told the gathering, "That right there was truly the voice of an angel. But then he whispered in my ear that he loved the movie Ted. And I told him that was not appropriate for a boy of his age."
"Holy Father please forgive me," he continued. "I've always hoped that the good Lord has a sense of humour when it comes and pertains to many of the movies that I've made."
Some people in the audience laughed, but the apology was lost on the Catholic leader, who then stepped up to deliver a speech about the importance of family.
Wahlberg later turned heads when he gave local football team the Philadelphia Eagles a shout out as he introduced footballer-turned-pastor Herb Lusk to the stage.
Earlier on in the event, Wahlberg also shared how religion had played a vital part in turning his own life around, after spending time behind bars for assault during his youth.
"I attribute all of my success to my Catholic faith," he said. "My faith has given me the ability to be a good father, a good husband and most importantly a good person."
The event also featured a performance from R&B stars Sister Sledge, who sang a rendition of their hit We Are Family prior to the Pope's arrival. Their appearance had been marred by family drama after youngest sister and former bandmember Kathy publicly begged her siblings to let her perform with them, but Joni, Debbie and Kim Sledge refused to let her participate.