When a Brazilian state prosecutor last year set out to silence anonymous Twitter messages that were revealing the location of drunk-driving checkpoints, he served the social media company's just-opened Sao Paulo office with a lawsuit.
Sharing sightings of police checkpoints does not violate any rules set by Twitter Inc, which has far fewer restrictions on content than social media rivals such as Facebook. Nor would such tweets be a crime in the United States. Twitter has traditionally resisted efforts to obtain the identity of users whose words might be regarded as a crime.
But in Brazil, Twitter quickly handed over the internet protocol addresses of three accounts as a demonstration of its "good faith, respect and will to cooperate with the Brazilian judicial power," the company's lawyers said in a legal filing last October.
Even that wasn't enough: the lawsuit, which demands that the company bar any such accounts in the future, is ongoing.
The situation in Brazil is a microcosm of the public policy and business challenges facing Twitter as it seeks to translate global popularity into profits.
Since its inception, the 140-character messaging service's simplicity and mobile-friendly nature - it can be used by any cellphone with a text-messaging function - has helped speed its global adoption as a source of real-time information. Unlike many social media services, it can be used anonymously.
The company's laissez-faire approach to monitoring content, together with an aggressive posture in challenging government censorship requests and demands for customer information, have made it the darling of civil liberties advocates and political protesters from New York's Zuccotti Park to Cairo's Tahrir Square.
But now, as it prepares to become a public company with a valuation expected to exceed $10 billion, Twitter must figure out how to make money outside the US.International customers make up more than 75 percent of Twitter users, but only 25 percent of sales come from overseas.
That means opening offices and employing people on the ground: there are now seven overseas offices and counting. And that, in turn, means complying with local laws - even when they conflict with the company's oft-stated positioning as "the free-speech wing of the free-speech party."
These conflicts, paradoxically, arise not so much in countries with repressive governments - the service is banned outright in China, for instance - but rather in countries with Western-style democracies, including Brazil, Germany, France, Britain and India.
"There are a bunch of countries that you can't treat like China because they have democratic systems and they abide by the rule of law, but they have speech restrictions that we would find objectionable," said Andrew McLaughlin, a former director of global public policy at Google Inc and White House technology official who is now chief executive of news website Digg. "Those are the issues where the rubber hits the road on free speech."
In Twitter's initial public offering prospectus, which was made public last week, there was only an oblique mention of protecting speech. The company said its corporate mission was to facilitate the dissemination of "ideas and information instantly without barriers," and that "our business and revenue will always follow that mission in ways that improve - and do not detract from - a free and global conversation."
Alex Macgillivray, the former general counsel who coined the company's free speech slogan and was widely regarded as a staunch civil libertarian, left the company in September.
Twitter declined to comment about potential conflicts between its business goals and its free-speech advocacy in general, or any specific cases.
There's certainly no shortage of political chatter on Twitter, and world leaders ranging from Iranian President Hassan Rouhani to Pope Francis have taken to the service as a means of communicating directly with constituents.
Activists say they haven't seen Twitter backing away from its free-speech policies yet - but they're wary.
"Twitter has always been an ally," said Hisham Almiraat, a Moroccan blogger who manages the anti-censorship website Global Voices Advocacy. "As soon as Twitter becomes public, it needs to be accountable to its shareholders, and its strategy becomes more short-term. If Twitter, for reasons of greed, or because they are politically compelled, decides to change that core philosophy, then I'll worry."
Opportunity in Brazil
A booming, social media-loving country of more than 80 million Internet users, Brazil perennially ranks among Twitter's most active markets. When the company set up operations in Sao Paulo in late 2012, the company's top sales executive, Adam Bain, described the opportunity in the country as "amazing from a business perspective."
As in many Latin American nations, the service is used by everyone from the president on down. And with Twitter proving to be a powerful companion medium for sports and other forms of televised entertainment, Brazil's role as host of the 2014 World Cup and 2016 Olympic Games make it an especially attractive target.
Yet the broad adoption of Twitter has not been accompanied by broad tolerance of the free-wheeling conversations that characterize social media in general and Twitter in particular. Brazilian government bodies regularly file more requests for user information or content removal than any country other than the US, according to transparency reports published periodically by companies including Twitter and Google.
Luis Fernando Canedo, the prosecutor in Brazil, described his case over the driving checkpoints as a landmark for the country - and also for Twitter, which had never before been sued by a government.
"Social networks are a relatively new reality and so is their impact," Canedo told Reuters. "There are future situations today we can't even imagine and in which the State will have to position itself in front of certain illegal, harmful practices being carried out over the Internet."
His case has not exactly gone smoothly. Even after obtaining Internet addresses from Twitter, the prosecutors misidentified the suspects behind the driving checkpoint Tweets.
They then dropped the case against the individuals, but still want Twitter to bar any such accounts in the future.
Hate speech in Europe
Twitter has long tried to hew to the position that users - not the company - are responsible for the content on the service. But last year it implemented a means of filtering Tweets by country, so that if it were forced to censor messages in one place it would still be able to show them in others.
That capability was used for the first time last October, when Twitter yielded to a request from German police to filter a neo-Nazi group's Twitter account so that users in Germany could not see it.
Earlier this year, just as Twitter's head of international strategy, Katie Jacobs Stanton, relocated toFrance to open Twitter's Paris office, Twitter's lawyers were fighting an order by a French court to reveal the email and IP addresses of users who had sent a spate of anti-Semitic tweets, which are prohibited under the country's hate-speech laws.
When Twitter exhausted its appeals in July, the company turned over the information.
In Britain, meanwhile, parliament in April passed a new defamation law that shifted liability to website operators for its users' posted content, which some observers said could hasten the end of online anonymity.
Like most global companies, Twitter has always acknowledged that it must obey the laws of the countries in which it operates. At the same time, though, it had little physical presence internationally and thus could take a hands-off approach.
Now, as Twitter grows its sales operation, absence is not a viable strategy.
"If you make the choice to operate in a country, you're subject to local laws," said Roy Gilbert, a former Google executive who set up the search giant's operations in India in 2004.
Twitter, moreover, may need local offices even more than some other Internet companies because its ad strategy depends on wooing large brand advertisers that need to be serviced by a direct sales presence, noted Clark Fredericksen, an analyst at eMarketer.
While Google can make money by allowing small businesses in a country to use its self-serve advertising platform, Twitter's self-serve ad product remains in its infancy and is only available in the US.
In countries such as Egypt and Turkey, Twitter has sought to avoid falling under local jurisdiction by selling ads through contractors, although it remains unclear whether the strategy will be tenable in the long run.
Amid massive anti-government protests fuelled by organisers on Twitter this summer, Turkish Prime Minister Tayyip Erdogan threatened to shut down the service, which he called a "scourge."
His government called on Twitter to set up an office in the country so it would fall under Turkish law. Twitter rebuffed the request and weeks later posted a job for an executive in Dublin to manage ad resellers within Turkey.
Ozgur Uckan, a communication professor at Istanbul Bilgi University, said authorities may still be able to pressure the company by targeting its local partners. "The authorities may try to force Twitter to comply, using their regulation tools like tax issues," Uckan said.
In recent months, the ruling party backed away from its efforts to muzzle the service. Instead, it is adopting a tactic that has raised yet more questions about Twitter's future in the country.
The ruling AK Party recruited thousands of volunteers and paid workers to join Twitter, two party sources told Reuters. The pro-government volunteers have employed tactics such as reporting their political rivals as spammers, leading to their accounts' suspension.
"We decided to fight against them with their own tool and now we are more active on Twitter," said one party member, who asked not to be named.
The tactics proved so successful that Twitter chief executive Dick Costolo was pressed to make a statement in July denying that the company was cooperating with the Turkish government to suspend opposition accounts.
"You can't imagine the internet without Twitter or Google. They are now considered the air you breathe," said Almiraat, the Moroccan blogger. "Now they're in a position of power, and they should be very careful with that power."