RICHMOND, Va. -- Ahead of his initial appearance in federal court Wednesday, former Subway pitchman Jared Fogle reached a plea agreement with prosecutors that would see him serve between five and 12½ years in prison for handling child pornography and having sex with a minor.

The federal case has a local connection.

Text messages and documents acquired from Jared's phones show that he engaged in sex acts with prostitutes and then paid them a finder's fee to provide access to minors for paid sex acts, according to court documents obtained by CBS 6. [READ DOCUMENTS HERE: Details of Jared Fogle plea deal ]

He engaged in sex acts with these prostitutes to determine that they were not police officers, according to the court documents.

Watch CBS 6 news starting at 5 p.m., to hear more about this local connection from reporter Joe St. George and legal analyst Todd Stone.

Fogle repeatedly discussed commercial sex acts with minors with prostitutes in other places than Richmond, including Kansas City, Mo., New York, NY, and Las Vegas, Nev., according to the plea deal details.

He also paid for some of these encounters at New York’s Plaza Hotel, court documents allege. One of the girls he paid for sex was an underage prostitute. Fogle sent her a text message saying he would also pay her if she could find an underage girl with whom he could have sex. Fogle, according to court documents, said he would accept a 16-year-old girl, adding “the younger the girl, the better.”

Fogle visited Richmond on Thursday April 19, 2012 as part of Subway's national safe driving campaign, W8 2 Text. As part of the campaign, he worked with high school students in some towns he visited.

Fogle and a sergeant from the Richmond Police Department discussed the Subway initiative on Virginia This Morning.

“Good to be back," Fogle said of Richmond. "It’s been a few years, but making the rounds again and excited for… an important cause to be back in town for.”

The court will have to approve the agreement, in which Fogle pleads guilty to possessing and distributing child porn, and to traveling across state lines to have sex with at least two teenage girls.

Under the plea deal, the government agrees to recommend less than 13 years in prison for Fogle. Also, Fogle's lawyers agree to ask the judge for no less than a 5-year prison term.

The charges against Fogle are related to his relationship with Russell C. Taylor, the executive director of the Jared Foundation, who was arrested more than two months ago on federal child pornography charges, according to court documents.

According to the plea deal and indictment:

• Between 2011 and April 2015, Fogle received from Taylor multiple pornographic images of minors engaging in sexually explicit contact.

• Fogle had conversations with Taylor about the child porn, but instead of alerting authorities, he "chose to benefit from such production by obtaining access to a significant amount of such material."

• The images and videos were recorded by Taylor at his home through the use of hidden cameras.

• Between 2010 and February 2013, Fogle traveled from Indiana to New York to pay to have sex with minors.

• One victim told investigators she had sex with Fogle twice when she was 17 in exchange for money, once at the Plaza Hotel and once at the Ritz Carlton, both in New York City.

• The same minor also said that Fogle had sex with her three other times before 2012, when she was 16.

• Prosecutors say that text messages, travel records, hotel records and a search of Fogle's home provided evidence of these arrangements.

• The same minor said Fogle had sex with another 16-year-old girl on another occasion.

• Prosecutors say they have talked to witnesses who can testify about conversations Fogle had with them offering a "finder's fee" for seeking minors for him.

The agreement says Fogle will adhere to a pornography ban and sexual disorders treatment, and he will have no unsupervised visits with minors, among other requirements.

Computer monitoring will be required, too.

Wife wants to end marriage

On the same day the indictment and plea deal became known, Fogle's wife, Katie, released a statement saying she wants out of the marriage.

"Obviously, I am extremely shocked and disappointed by the recent developments involving Jared," she said in a statement via her attorney. "I am in the process of seeking a dissolution of the marriage. My focus is exclusively on the well-being of my children."

His family also released a statement.

“Our family is shocked and profoundly disappointed in Jared's abhorrent criminal behavior and we are very concerned for the well being of those affected by his conduct. At the same time, we are gratified that Jared is accepting responsibility for what he has done by agreeing to plea guilty to the charges filed today and by volunteering to make restitution to the victims. We are also gratified that he is seeking medical treatment. We hope that he will become healthy again and are confident that after he serves his sentence, he will continue to make amends. We look forward to the day that he rejoins our family and society. “We will not be granting any media interviews. Our plan is to comfort each other and heal and we ask that the media respect our family's privacy during this very difficult time.”

Weight loss claim made him famous

Fogle became a household name as "Jared from Subway" after a dramatic weight loss that he attributed to eating at Subway restaurants. He became famous in 2000 when the sandwich chain released a commercial centered on his claims that he dropped about 245 pounds -- from a peak weight of 425 -- in one year as an Indiana University student, thanks in part to exercise and a simpler diet involving Subway subs.

The sandwich chain suspended its relationship with Fogle earlier this year after investigators raided his Indiana home.

Jared Fogle’s actions are inexcusable and do not represent our brand’s values. We had already ended our relationship with Jared. — SUBWAY® (@SUBWAY) August 19, 2015

Authorities previously said that Taylor, 43, of Indianapolis, was charged in May with seven counts of production of child pornography and one count of possession of child pornography.

During an April search at Taylor's home, authorities found "a cache of sexually explicit photos and videos Taylor allegedly produced by secretly filming minor children" there, federal prosecutors said in statement.

Celebrity status

After Subway heard his story and hired him, Fogle was globetrotting from Canada to Australia, talking health and hoagies.

His celebrity grew. He was asked to serve as grand marshal in NASCAR races, and he helped ferry the Olympic torch through Indiana ahead of the Salt Lake City Games.

He flipped the coin before the 2003 Fiesta Bowl and began traveling the world visiting troops. In 2006, the same year he started the Jared Foundation, he penned a memoir, "Jared, the Subway Guy: Winning Through Losing: 13 Lessons for Turning Your Life Around."

This fame helped him become one of the biggest -- and most effective -- faces in advertising, according to a 2013 study by Technomic's Consumer Brand Metrics, which monitors 120 eateries' brands on attributes including image and customer loyalty, according to Advertising Age.