Former Eagles linebacker Mychal Kendricks was charged Wednesday with trading cash kickbacks, NFL tickets, and invitations to celebrity-filled events for inside stock tips in an alleged scheme that prosecutors said illegally netted him nearly $1.2 million in profits.

Working with a Harvard-educated Wall Street analyst, Kendricks received confidential financial information on four companies that eventually were acquired in deals that sent their stock prices soaring, authorities allege.

Both Kendricks, 27, of Philadelphia, and his codefendant, Damilare Sonoiki, 27, of Fresno, Calif. — who has since left the financial industry to become a TV writer on ABC's hit comedy Black-ish and Fox's The Simpsons  — are expected to plead guilty to crimes that occurred between 2013 and 2015.

The charges, filed in federal court in Philadelphia, set the worlds of sports, high finance, and Hollywood abuzz.

"When individuals engage in insider trading … it undermines the public's faith in our markets and harms ordinary investors that do play by the rules," U.S. Attorney William M. McSwain said at a news conference announcing the charges in Center City. "Mr. Sonoiki and Mr. Kendricks were definitely not playing by the rules."

Kendricks, who was part of the Eagles' Super Bowl-winning team and afterward signed with the Cleveland Browns, apologized to his family, the NFL, his coaches, teammates, and the owners of both football teams.

In a statement released by his attorney, he admitted to committing the crimes but suggested he was taken in by Sonoiki's pedigree at Harvard and Goldman Sachs, the investment firm where Sonoiki worked at the time. Kendricks pledged to repay all the funds he gained illegally.

"While I didn't fully understand all of the details of the illegal trades, I knew it was wrong," he said. "I wholeheartedly regret my actions."

>>IMAGE GALLERY: Former Philadephia Eagle Mychal Kendricks

In a statement of their own issued Wednesday night, the Browns said they had decided to release Kendricks from the team.

The Browns said that although they were aware of the investigation when they signed Kendricks to a one-year, $2.25 million deal in June, they were led to believe by the linebacker's representatives that he would not be charged with crimes.

"We were told Mychal had fully cooperated with investigators as a victim," Browns general manager John Dorsey said. "Recently, we were provided an update on the matter and the circumstances have changed."

Sonoiki's lawyer, Mark Wilson of the Federal Public Defender's Office in Philadelphia, declined to respond to the allegations.

Court filings, including a separate lawsuit against both men also filed Wednesday by the Securities and Exchange Commission, paint a portrait of two men who rose from similarly troubled backgrounds and quickly found success in their chosen fields – success that both were eager to build upon to secure their financial futures.

Kendricks overcame an upbringing by a cocaine-addicted father in California to secure a coveted berth on the Eagles' starting roster in 2012, hailed as a future star.

Sonoiki, a Nigerian immigrant raised in southwest Houston, landed at Harvard after being selected to attend Woodberry Forest School, an exclusive Virginia boarding school. In a commencement speech at the university in 2013, he spoke of his childhood home being shot up in drive-bys and said he himself was once accidentally shot.

Although he had dreams of comedy writing – and even wrote for the Harvard Lampoon – Sonoiki said he felt pressure as a first-generation immigrant to succeed financially, which drove him to Wall Street and a job in the technology, media, and telecommunications division at Goldman Sachs.

The two men met at a party in late 2013, court documents show, and their financial scheme allegedly began soon after. Kendricks was then barely a year into his contract with Eagles, which was paying him $1.2 million a year.

"I'm at a messed up place as far as my money is concerned," he complained to Sonoiki in an August 2014 text message quoted in court papers. "I have enough money to live and to support myself, but not enough money to avoid taxes … I don't have enough money to buy a business and get the tax breaks I need."

Over the next several months, Sonoiki repeatedly contacted the linebacker with advance notice of mergers and acquisitions that he had learned about confidentially through his job, according to court papers. The two kept most of their communications offline, but text messages quoted in court filings suggest they tried to cover the true nature of the information Sonoiki was sharing with code.

>>>READ MORE: The alleged deals

For instance, when Kendricks allegedly moved $80,000 into a brokerage account in July 2014 so Sonoiki could buy stock in Compuware, a Detroit software company that was about to be acquired by a private equity firm, the linebacker alerted the analyst that he had "moved 80" via a text.

Sonoiki replied: "You should keep the number 95" — a reference to the number on Kendricks' team jersey.

Later, while allegedly planning for another illegal trade, Sonoiki suggested that Kendricks bring the money for the stock purchase – which he referred to as "bread" – with him on a trip to New York City.

"Try to have the bread if you can," he texted, according to the court filings. "The bread in NYC just isn't the same and I really like my cheesesteaks with the stuff you all have in Philly."

Sometimes the trades were carried out by a third man not named in court filings, but whom prosecutors described as a middleman and a friend of Kendricks'.

In exchange, Kendricks allegedly paid Sonoiki $10,000 in kickbacks, gave him Eagles tickets, and invited him to nightclub promotions and to the set of a music video featuring pop star Teyana Taylor.

The Eagles announced in May that they decided to cut ties with Kendricks, who started 13 games for the team last season. Sonoiki wrote for Black-ish in the 2015-16 season and began working as a writer for The Simpsons this year.

Both men face charges of conspiracy and securities fraud, punishable by up to 25 years in prison. U.S. District Judge Gene E.K. Pratter has not set a date to accept their guilty pleas.

Staff writers Les Bowen, Tommy Rowan, and Joseph A. Gambardello contributed to this article.