Harry Shearer, who voices Mr. Burns and Ned Flanders on The Simpsons, is leaving the show after nearly 30 years amid a contract dispute.

Shearer announced his own departure via Twitter late Wednesday night, saying he wanted "the freedom to do other work."

Showrunner Al Jean confirmed Shearer's departure in a statement Thursday morning and said that his roles will be recast.

"Harry Shearer was offered the same deal the rest of the cast accepted, and passed," Jean told TVGuide.com in a joint statement with executive producers James L. Brooks and Matt Groening. "The show will go on and we wish him well. Maggie took it hard. We do not plan to kill off characters like Burns and Flanders but will recast with the finest voiceover talent available."

Jean also reassured fans via Twitter that The Simpsons will continue.

Last week, the network announced that The Simpsons had been renewed for Seasons 27 and 28.

Shearer has been with The Simpsons since it originated on The Tracey Ullman Show in 1989. Other characters he voices include Waylon Smithers and Principal Skinner.

In 2011, the cast members agreed to a 45 percent pay cut. In the middle of those negotiations, Shearer released a statement saying he would be willing to take a 70 percent pay cut in return for "a small share" of the show's future profits.