The top lawyer and advocate for free speech at Twitter has left the company; the surprise move comes as Twitter prepares for its long-awaited initial public offering.

Lawyer Alexander Macgillivray was renowned for his tireless efforts defending Twitter users’ legal right to express whatever they could think in 140 characters or less. He announced his resignation in the only way he would - via a post on Twitter.

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

Macgillivray has been praised for his willingness to go against his own company’s infringements on the right of free expression, criticising Twitter on numerous occasions for censoring content and banning users.

“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,” Macgillivray tweeted.