Twitter's defender of free speech unexpectedly stepped down as general counsel on Friday as the microblogging company moved closer toward a long-expected initial public offering.

Alexander Macgillivray, known for fending off legal challenges to Twitter users' right to express themselves in pithy, 140-character messages, himself tweeted the news without giving a reason for the move.

But Macgillivray, who became Twitter's top legal officer in September 2009, said would continue to support the San Francisco-based company as an adviser.

Twitter declined to comment, but said Macgillivray would be replaced by Vijaya Gadde, who has been managing the company's corporate and international legal work. Gadde is a former senior director in Juniper Networks Inc's legal department.

Gadde has deep experience in corporate and securities law, while Macgillivray's specialty is intellectual property.

Twitter, which has more than 200 million active users, is widely expected to go public in 2014.

Macgillivray said in his blog post that he was looking forward to the change.

"I'm looking forward to engaging my various internet passions from new and different perspectives, seeing friends and family without distraction, and just goofing off a bit. We should all do more of that," he tweeted.

(Reporting by Alexei Oreskovic; Editing by Richard Chang)