Twitter has posted its first quarterly profit in the company’s 12-year history, although a clampdown on fake accounts meant it lost users in the US and overall user growth stalled.

The San Francisco-based social network, which went public five years ago, made a profit of $91m (£65m) in the fourth quarter of 2017, compared with a $167m loss a year earlier, after cutting costs.

It also returned to revenue growth as video ad sales rose, with revenue up 2% year on year to $732m. Twitter’s annual loss shrank to $108m from $457m in 2016. It expects to make its first annual profit this year. Shares jumped more than 20% on the news.

However, the site favoured by Donald Trump, celebrities and politicians struggled to increase user numbers, despite the publicity created by the president’s frequent tweets. In a letter to shareholders, Twitter said it had stepped up efforts to reduce spam, automated accounts known as bots and fake accounts.

The company had 330 million monthly active users in the quarter, up 4% year on year, but growth stalled compared with the previous quarter. The number was below the 332.5 million expected by Wall Street. A change that Apple made to its Safari web browser reduced the tally by 2 million.

But, as with “troll” and “fake news”, the strict definition has been forgotten as the term has become one of political conflict. The core of the debate is the accusation that a number of political tweets were sent by “Russian bots”, with the intention of subverting political debate, or simply creating chaos generally.

Based on what we know about Russian information warfare, the Twitter accounts run by the country’s “troll army”, based in a nondescript office building in St Petersburg, are unlikely to be automated at all. Instead, accounts like @SouthLoneStar, which pretended to be a Texan right-winger, were probably run by individuals paid 45-65,000 rubles a month to sow discord in Western politics.

In other ways, they resembled bots – hence the confusion. They rarely tweeted about themselves, sent far more posts than a typical user, and were single-minded in what they shared. People behaving like bots pretending to be people: this is the nature of modern propaganda.

In the US, where Twitter makes most of its revenue, the number of users dipped to 68 million from 69 million in the third quarter.

The network faces tough competition from bigger rivals such as Facebook, which has 2.1 billion monthly users, along with more recent arrivals including Snapchat and Instagram.

But Michael Connor, whose Open Mic group recently helped two large Twitter and Facebook shareholders file resolutions asking the companies to take more responsibility for fake news, abuse and hate speech, said Twitter was not doing enough to address these issues.

“They are playing whack-a-mole with these problems,” he told AP. “They say they have the problem under control, but they don’t know what the problem is exactly.”

Twitter’s chief executive, Jack Dorsey, has in the past year tweaked the product he co-founded to attract more users. Twitter doubled the number of characters allowed in each tweet in most languages, from 140 to 280. It also signed deals with media companies to live-stream news, sports events and entertainment shows.