NEW YORK -- Twitter co-founder Jack Dorsey has stepped down as CEO of the social media platform. He has been succeeded by Twitter's current chief technology officer, Parag Agrawal.

Dorsey will remain on the board until his term expires in 2022. Agrawal joined Twitter in 2011 and has been CTO since 2017.

In a letter posted on his Twitter account, Dorsey said he was "really sad...yet really happy" about leaving the company and that it was his decision. On Sunday, Dorsey had sent a cryptic tweet reading only "I love Twitter."

Twitter shares rose 5% to $49.47 in morning trading after the announcement.

Twitter was caught up in the heated political atmosphere leading up to the 2020 election, particularly when it banned former President Donald Trump following his incitement of the Jan. 6 riot at the U.S. Capitol. Dorsey defended the move, saying Trump's tweets after the event resulted in a risk to public safety and created an "extraordinary and untenable circumstance" for the company. Trump sued the company, along with Facebook and YouTube, in July for alleged censorship.

Critics argued that Twitter took too long to address hate speech, harassment and other harmful activity on its platform, particularly during the 2020 campaign.

"If he's actually stepping away from Twitter this time, Dorsey leaves behind a mixed legacy," said Paul Barrett, deputy director of the NYU Stern Center for Business and Human Rights. "A platform that's useful and potent for quick communication but one that's been exploited by a range of bad actors, including former President Donald Trump, who did his best on Twitter to undermine democracy -- until Dorsey's people finally had enough and shut him down."

Dorsey has faced several distractions as CEO, starting with the fact that he's also founder and CEO of the payments company Square. Some big investors have openly questioned whether he could effectively lead both companies.

Last year, the company came to an agreement with two of those activist investors that kept Dorsey in the top job and gave a seat on the company board to Elliott Management Corp., which owned about 4% of Twitter's stock, and another to Silver Lake.

While Twitter has high-profile users like politicians and celebrities and is a favorite of journalists, its user base lags far behind old rivals like Facebook and YouTube and newer ones like TikTok. It has just over 200 million daily active users, a common industry metric.

Agrawal, meanwhile, is far less well known than Dorsey. He previously worked at Microsoft, Yahoo and AT&T in research roles. At Twitter, he's worked on machine learning, revenue and consumer engineering and helping with audience growth. An immigrant from India, he studied at Stanford and the Indian Institute of Technology, Bombay.

As CEO, he'll have to step out from his largely technical background and deal with the social and political issues Twitter and social media are struggling with, including misinformation, abuse and effects on mental health.

The early days of Twitter began with a tweet sent by Dorsey on March 21, 2006, that read "just setting up my twttr." Twitter went through a period of robust growth during its early years, but as its expansion slowed the San Francisco company began tweaking its format in a bid to make it easier and more engaging to use.

Dorsey became Twitter CEO in 2007, but was forced out the following year. He returned to the role in 2015. In his goodbye letter, Dorsey said he has "worked hard to ensure this company can break away from its founding and founders" and that to focus too much on whether companies are led by their founders is "severely limiting."

Twitter also announced on Monday a new board chairman, Bret Taylor, to replace its existing chair, Patrick Pichette. Pichette will remain on the board. Taylor has been on Twitter's board since 2016 and is the president and COO of business software company Salesforce.