Twitter once dumped co-founder Jack Dorsey as its CEO because he was deemed unqualified for the job. Now, the short-messaging service is giving Dorsey a second chance, at least temporarily, to prove he can turn Twitter into a profitable business and lure more people into sharing tidbits of news, entertainment, insight and tedium.

Twitter CEO Dick Costolo, who helped turn the trendy messaging startup into a global town square, is stepping down amid criticism over the company’s disappointing financial performance and a recent stock slide.

Dorsey’s return as Twitter’s interim CEO, effective July 1, is the latest peculiar twist at a San Francisco company teeming with the drama of a soap opera through much of its nine-year history.

Investors greeted the move with enthusiasm, driving Twitter shares up nearly 6 percent in late trading after the announcement Thursday afternoon. Both Dorsey and Costolo, however, expressed confidence in the company’s direction and said the board isn’t seeking major changes.

“I believe in the course the company is on and the management team’s ability to fulfill that and execute on it,” Dorsey, who is also board chairman, said during a joint conference call with Costolo and Wall Street analysts.

Both men characterized Costolo’s departure, effective July 1, as voluntary. The 51-year-old Costolo said he began talking with Twitter directors about leaving last year, although he did not say what he plans to do next. He will not receive any severance package.

Costolo had been Twitter’s CEO for five years and led the company through a successful stock market debut in 2013. Though he once worked as a stand-up comedian, Costolohas a degree in computer science and led three earlier tech startups, including one that he sold to Google. He was hired as chief operating officer for Twitter in 2009, three years after its launch.

Even Twitter’s origins are a matter of dispute. Dorsey has said he came up with the idea on his own while at a San Francisco playground. That accounts conflicts with another Twitter co-founder, Noah Glass, who said he and Dorsey came up with the concept while sitting in a car parked on a rain-slickened street in San Francisco at the end of an evening drinking vodka.

Here’s quick look at the cast of characters that have passed through Twitter’s revolving CEO door:

JACK DORSEY

A one-time punk rocker who once wore a nose ring, Dorsey is sometimes touted as the technology industry’s next Steve Jobs — a comparison that he has never discouraged.

Dorsey’s appointment as Twitter’s interim CEO draws more parallels with Jobs, Apple’s co-founder. After being ousted from Apple in the mid-1980s, Jobs came back as the company’s interim CEO in 1997 and then stayed on oversee the creation of the iPod, iPhone and iPad.

While running Apple, Jobs also was CEO of computer animation pioneer Pixar. Dorsey, 38, will remain CEO at another San Francisco company, mobile payment processor Square, while guiding Twitter.

Dorsey should be highly motivated to lift Twitter’s stock price, which has plunged by about 30 percent since the late April release of its first-quarter results amplified investor concerns about the company’s uninterrupted history of losses. He owns a 3.6 percent stake in Twitter currently worth about $850 million.

EVAN WILLIAMS

Williams, a Twitter co-founder who grew up as a Nebraska farm boy, cast aside Dorsey as CEO in 2008. At that time, Williams was considered to be a better suited leader as Twitter tried to mature from a fun-loving startup plagued by frequent service outages.

As part of the change in command, Dorsey handed over the voting rights of his Twitter stock to Williams. Dorsey regained those rights when Twitter completed its initial public offering of stock in November 2013.

Williams remains a Twitter director and the company’s largest stockholder with a 7.8 percent stake worth $1.8 billion.

DICK COSTOLO

Twitter turned to this former stand-up comic as he got more serious about the business side of things. After joining Twitter as its chief operating officer in 2009, Costolo replaced Williams as CEO less than a year later.

Costolo brought more stability to Twitter’s service by building more data centers to handle all the tweets. He also oversaw a period of rapid user and employee growth while injecting ads into Twitter’s stream of tweets. Those achievements have been eclipsed by his inability to come up for a formula for making money at Twitter. Many analysts also blame Costolo for the structure of Twitter’s service, which has been criticized as being too complicated for casual users to understand and navigate.

Not long after he took over the reins, Costolo convinced Dorsey to come back to Twitter as an adviser — a role that cracked the door for Dorsey’s imminent return as interim CEO.