Virginia Sherwood/MSNBC

Keith Olbermann, the highest-rated host on MSNBC, announced abruptly on the air Friday night that he was leaving his show, “Countdown,” immediately.

The host, who has had a stormy relationship with the management of the network for some time, especially since he was suspended for two days last November, came to an agreement with NBC’s corporate management late this week to settle his contract and step down.

In a closing statement on his show, Mr. Olbermann said simply that it would be the last edition of the program. He offered no explanation other than on occasion “all that surrounded the show – but never the show itself – was just too much for me.”

Mr. Olbermann thanked his viewers for their enthusiastic support of a show that had “gradually established its position as antiestablishment.”

In a statement, MSNBC said: “MSNBC and Keith Olbermann have ended their contract. The last broadcast of ‘Countdown with Keith Olbermann’ will be this evening. MSNBC thanks Keith for his integral role in MSNBC’s success and we wish him well in his future endeavors.”

NBC executives said the move had nothing to do with the impending takeover of NBC Universal by Comcast. With viewers and fans of Mr. Olbermann suggesting that Comcast was responsible for forcing Mr. Olbermann out, Comcast also released an official statement late Friday night:

“Comcast has not closed the transaction for NBC Universal and has no operational control at any of its properties including MSNBC. We pledged from the day the deal was announced that we would not interfere with NBC Universal’s news operations. We have not and we will not.”

MSNBC announced that “The Last Word” with Lawrence O’Donnell would replace “Countdown” at 8 p.m., with “The Ed Show” with Ed Schultz taking Mr. O’Donnell’s slot at 10 p.m. Mr. Olbermann did not discuss any future plans, but NBC executives said one term of his settlement would keep him from moving to another network for an extended period of time.

Mr. Olbermann signed a four-year contract extension in 2008 for an estimated $30 million. He had hosted “Countdown” at 8 p.m. since 2003 and it became the foundation of the channel’s surge to its status as the second-ranked news channel on cable television, after Fox News, surpassing the one-time leader CNN.

Mr. Olbermann’s outspoken, and sometimes controversial, support of liberal positions and Democratic candidates redefined MSNBC from a neutral news channel to one that openly offered a voice to viewers on the left, much as Fox News has done for conservatives.

Mr. Olbermann challenged Fox News publicly on numerous occasions, especially the top-rated cable host Bill O’Reilly.

Ratings for Mr. Olbermann’s show grew, though he never approached Mr. O’Reilly’s level of popularity. But he helped expand the MSNBC brand by his frequent invitations to Rachel Maddow, who was eventually offered her own show on MSNBC.

Ms. Maddow became the 9 p.m. host following Mr. Olbermann and has built such a successful show that some NBC executives felt less concerned about losing Mr. Olbermann as the signature star of the network.

According to several senior network executives, NBC’s management had been close to firing Mr. Olbermann on previous occasions, most recently in November after he revealed that he had made donations to several Democratic candidates in 2010 — one of them, coincidentally, was Representative Gabrielle Giffords, who has been the subject of many of his recent shows after being shot in an assassination attempt.

The top MSNBC executive, Phil Griffin, said the donations had violated NBC News standards and ordered Mr. Olbermann suspended. His fans responded with a petition to reinstate him that attracted over 250,000 signatures. Mr. Olbermann returned two days later. In his response he said the rules on donations had been “inconsistently applied.”