SAN FRANCISCO — Groupon Inc. fired Andrew Mason as chief executive officer on Thursday, ousting a co-founder who captured headlines with his quirky style but failed to reverse a crumbling share price and gradual erosion of its daily deals business.

The leader in Internet daily deals has now launched a search for a new leader to turn the company around, the same day its stock slid 24 percent after dismal quarterly results.

In an unusually candid post-firing letter, Mason — known for his atypical sense of humor — confessed he was getting in the way of the company he co-founded just a few years ago, and had failed in his role as leader.

“After four and a half intense and wonderful years as CEO of Groupon, I’ve decided that I’d like to spend more time with my family. Just kidding — I was fired today. If you’re wondering why… you haven’t been paying attention,” Mason wrote in a memo addressed to the People of Groupon and made available to Reuters. “From controversial metrics in our S1 to our material weakness to two quarters of missing our own expectations and a stock price that’s hovering around one quarter of our listing price, the events of the last year and a half speak for themselves. As CEO, I am accountable.”

Co-founder Eric Lefkofsky and board member Ted Leonsis will lead the company in the interim, until a permanent CEO is found.

“We all know our operational and financial performance has eroded the confidence of many of our supporters, both inside and outside of the company. Now our task at hand is to win back their support,” the pair wrote in a joint letter to employees.

The company’s stock closed 24 percent lower on Thursday after the daily deals company posted a surprise quarterly loss on Wednesday, partly because it took a smaller cut of revenue from merchants offering holiday season discounts.

“The next person who comes in will have tough road ahead. The new CEO will have to be somebody with a strong stomach,” said Dan Niles, chief investment officer at AlphaOne Capital. “It’s a lot like J.C. Penney. Changing the CEO is not going to change the fundamental tough aspects of the business. J.C. Penney stock did great when they replaced the CEO, and look what has happened since then.”

Shares in the company rose as much as 8 percent in after-hours trade, from a close of $4.53 on the Nasdaq. It has now lost three quarters of its value since its November 2011 initial public offering at $20.