A Swedish government agency on information apologized for blocking briefly from its account on Twitter thousands of users, including that of Israel’s ambassador in Stockholm, that it flagged as engaging in hate speech.

The Swedish Institute published the apology Tuesday on the Swedish-language edition of its website, in which it also stated that it has removed the blocks from all accounts that had been suspended earlier this week.

The block, which is the Twitter equivalent to “unfriending” someone on Facebook, prevented some 14,000 users from using the username @sweden, which is owned by the Swedish Institute, and reading its Twitter feed. It did not otherwise limit their use of the social network or the Internet.

“The Swedish Institute apologizes to those who have been blocked mistakenly,” read the statement.

In addition to the private Twitter account of Isaac Bachman, the Israeli ambassador, and his embassy’s official account, blocked accounts included that of the award-winning journalist Magda Gad of the liberal Expressen daily, the lawmaker Jimmie Åkesson of the nationalist Sweden Democrats party, and the well-known novelist Jonas Gardell, who is a well-known activist for gay and transsexual rights in Sweden.

Bachman, who has used harsh language in criticizing of Sweden’s policies on Israel, took to Twitter to protest the block, which he noted was not extended to Iran and Saudi Arabia, which have laws discriminating homosexuals and women, and which fund purveyors of anti-Semitic hate speech.

Now, that #Israel 's MFA and ambassador are blocked - #Sweden is much safer in reading Iran and others, that were not blocked.@SweInstitute https://t.co/C87XzwTikb — Isaac Bachman (@isaacbachman) May 16, 2017

The blocks prompted criticism in local media on the Swedish Institute, which was accused of silencing critical debate about Sweden and imposing unnecessary limitations on free speech to preserve a far-reaching definition of political correctness. The Swedish Institute neither published a full list of those blocked nor offer those affected recourse to challenge the decision.

While it apologized for any wrongful block, the Swedish Institute in its statement defended the use of the tool to achieve what it called an improved atmosphere online.

“The Swedish Institute in the past has given its moderators permission to block users but last week it happened on a larger scale” with the intention not only of stopping alleged hate speech but also preventing it, the statement read.

“The blocks contributed to increased security on the account and to a significant improvement in dialog,” the statement continued. “But the institute also sees the need to examine the question of freedom of expression and the use of authority” in this context.

Hate speech online “is a major concern for freedom of expression and freedom of opinion,” Jenny Ljung, the head of the Swedish Institute, wrote in the statement.