Twitter’s announcement comes as many tech companies, including Facebook and Google, which operates YouTube, have struggled to balance free speech with their own policies against hateful and offensive content. Facebook is in the process of establishing an independent oversight board to review its decisions on content moderation. YouTube this month banned videos that promote white supremacy and neo-Nazism, after users expressed outrage that such content was easily accessible on the site. But the company opted to keep up videos by a prominent conservative creator in which he used homophobic slurs to describe a journalist. YouTube called the videos “offensive” but ruled that they did not violate its policies.

Twitter’s move is the company’s latest attempt to manage inflammatory tweets while trying to avoid accusations of favoring one political side over another. Some critics say the company has allowed politicians, including President Trump, to post messages that break the company’s terms of service. Mr. Trump, who has nearly 62 million followers on the platform, has used Twitter to threaten nuclear war with North Korea and to post a video that portrayed violence toward a news outlet.

But Mr. Trump, and many other conservatives, regularly complain that Twitter limits their reach on the service. They say that Twitter is biased against conservative users, an accusation that Twitter has repeatedly denied.

Other world leaders, including President Jair Bolsonaro of Brazil and Ayatollah Ali Khamenei of Iran, have used Twitter to share content that would typically be removed by Twitter if it were posted by average users. In March, Mr. Bolsonaro tweeted a pornographic video to denounce São Paulo’s Carnaval festival, while Mr. Khamenei frequently uses his Twitter account to call for Israel to be “eradicated.”

[Get the Bits newsletter for the latest from Silicon Valley and the technology industry.]

Employees from Twitter’s policy and legal teams decide when to apply the warning label to a tweet, and they will also seek input from employees in regional teams who can provide context about the political climate in the countries where they work, a Twitter spokeswoman said.