Lawrence O'Donnell is keeping his show on MSNBC.

The liberal commentator, one of President Trump's harshest critics on cable news, had been engaged in very public negotiations with the network over his contract, which was due to expire this weekend.

But he ended his show Wednesday night with an announcement that he's staying.

He started the final segment with a tease: "And now it is time for a fond farewell." But he was talking about an intern on the show who is leaving to take a permanent job.

Then O'Donnell said, "You know where I'll be next week? I will be sitting right here, talking about the James Comey hearing and everything else that happens next week and everything that happens for the next couple of years."

He confirmed the news in a tweet after the show, writing: "Yes I will be saying hi to Rachel Maddow at 10 pm for the foreseeable future."

Yes I will be saying hi to Rachel @maddow at 10pm for the foreseeable future. https://t.co/LKlkRTXL3F — Lawrence O'Donnell (@Lawrence) June 1, 2017

Maddow, whose show precedes O'Donnell's, has recently drawn the highest ratings in cable news among the demographic most coveted by advertisers.

Related: Fox News losing out in prime time ratings race amid Trump turmoil

O'Donnell, a former Democratic staffer on Capitol Hill and writer for "The West Wing," has earned strong ratings as well. Liberal supporters had demanded his contracted by renewed, and even held a rally outside the network offices.

MSNBC did not respond to a request for comment early Thursday.