For a sitting head of state, Toomas Hendrik Ilves spends an awful lot of time on the internet. Most world leaders leave their online presence to aides, punctuated only by the occasional initialized platitude. The president of Estonia, however, spends hours a day reading, writing, and tweeting to his nearly 17,000 followers about issues ranging from European Union border controls to the latest Thomas Pynchon novel.

That follower count may seem modest: Barack Obama is just shy of 37 million. But what’s remarkable is that, unique among world leaders, Ilves really gets it. His account is not just a public relations tool. It’s really him there touting Estonia’s buoyant startup scene; warning of Russia’s aggressive policies toward its former satellite states in Eastern Europe; and rebuking people who put his country down. Not bad for the head of a tiny Baltic state of 1.3 million with little in the way of executive power (most of which is concentrated in the prime minister’s office).

“That’s sort of how I thought of being a president: talking about things,” Ilves told BuzzFeed in a midtown Manhattan hotel on the eve of the United Nations General Assembly. “Since I’ve been writing about things my entire life, I thought, well, that’s what I would do as a president, is to read and then write and talk about things that are interesting to me.”

Ilves, 59, is equal parts Old World intellectual and 21st-century tech maven, wearing a bow tie and casually quoting Alexander Pope while discussing the finer points of geopolitics and data systems. In his mind, it all fits together. “There was a period in my life when I was very young that I wrote a sonnet a day just to learn concision in writing,” he says. “If you think about it, a sonnet is 14 lines of 10 syllables, so your Twitter is one degree lower: It’s not 140 syllables, which a sonnet is, it’s 140 characters, so that requires even greater concision.”

Nor is he a stranger to an old-fashioned intellectual mudfight. Ilves doesn’t suffer fools: His mission on Twitter is in no small part to combat ignorance and inaccuracy when it comes to his country. “I keep reading things,” he says, “where I think, My God, why don’t you perhaps look into what you’re talking about instead of spouting off the top of your head!” Nobel Prize-winning economist Paul Krugman found that out last year when he wrote a 66-word New York Timesblog post belittling Estonia’s austerity program, asking, “Is this what passes for economic triumph?” Ilves took personal offense, which he expressed in an extraordinary series of tweets:

Let's write about something we know nothing about & be smug, overbearing & patronizing: after all, they're just wogs: http://t.co/EWZ5YCIT

— toomas hendrik ilves (@IlvesToomas)

toomas hendrik ilves

@IlvesToomas

Let’s write about something we know nothing about & be smug, overbearing & patronizing: after all, they’re just wogs: http://t.co/EWZ5YCIT

/ Via

Guess a Nobel in trade means you can pontificate on fiscal matters & declare my country a "wasteland". Must be a Princeton vs Columbia thing

— toomas hendrik ilves (@IlvesToomas)

toomas hendrik ilves

@IlvesToomas

Guess a Nobel in trade means you can pontificate on fiscal matters & declare my country a “wasteland”. Must be a Princeton vs Columbia thing

/ Via

But yes, what do we know? We're just dumb & silly East Europeans. Unenlightened. Someday we too will understand. Nostra culpa.

— toomas hendrik ilves (@IlvesToomas)

toomas hendrik ilves

@IlvesToomas

But yes, what do we know? We’re just dumb & silly East Europeans. Unenlightened. Someday we too will understand. Nostra culpa.

/ Via

Let's sh*t on East Europeans: their English is bad, won't respond & actually do what they've agreed to & reelect govts that are responsible.

— toomas hendrik ilves (@IlvesToomas)

toomas hendrik ilves

@IlvesToomas

Let’s sh*t on East Europeans: their English is bad, won’t respond & actually do what they’ve agreed to & reelect govts that are responsible.

“It’s not an ideological issue, it’s just being really snide and nasty about an entire country. This is not how people speak! So I just thought I’d answer him in the same way,” Ilves says. “His knowledge of what was going on in Estonia was absurd, the conditions that we were in — we couldn’t borrow anything from anyone, so we had no choice but to do austerity. If you can’t borrow money, you’re not going to have a Keynesian program.”

Ilves’ rant quickly became the stuff of legend. A composer premiered an “austerity opera” devoted to it in the Estonian capital, Tallinn, in April, which the president declined to attend. (His son, however, did.) Krugman shrugged it off and called Ilves’ reaction “hysterical.”

If Ilves seems less like a politician or diplomat than a writer who just happens to be the president of a country, that’s no coincidence. He was born in Stockholm to exile parents who fled Estonia in 1944 after the Red Army retook the country from German occupation. It remained part of the Soviet Union until 1991. He grew up in Bergen County, New Jersey, where he was high school valedictorian and made what he jokingly calls “my first politically controversial speech” decrying rote factual learning. After studying philosophy at Columbia University and doing odd academic jobs, he moved to Munich to head up Radio Free Europe’s Estonian desk at the end of the Cold War. He didn’t so much as set foot in Estonia until he was 30.

As president, a post he has occupied since 2006, Ilves is the public face of Estonia’s remarkable rise from Soviet obscurity to online trendsetter. Estonia was one of the first countries to put government functions like voting and tax returns online and has one of the highest internet penetration rates in the world. Freedom House gave Estonia its top internet freedom ranking in 2012. The runaway success of Skype, an Estonian company, has nurtured a buoyant startup scene in Tallinn (according to The Economist, Estonia may have the world’s most startups per person). All Estonians over 16, including those outside the country, have access to a national two-factor, 2048-bit public key encryption system. To put that in perspective, that’s four times the capabilities of Lavabit — the encrypted email provider used by whistle-blower Edward Snowden — which recently decided to shut down rather than comply with legal pressure from the National Security Agency.

Ilves says his Twitter presence in particular “has contributed significantly to people understanding what Estonia has done in IT. People have actually figured out that Estonia is one of the few post-Communist countries that has a genuine image in people’s minds as being something.” Later, he switches from his Jersey baritone to a mock nasal Eastern Bloc accent: “Normally, I’d have to tell people, ‘Esto-o-o-nia is a very small country in E-e-e-astern Europe…’”

Estonia’s success is particularly remarkable when compared with other former Soviet countries outside the Baltics. Even relative success stories like Ukraine and Georgia have edged away from the EU and U.S., and failed to fulfill optimistic Western predictions that former Soviet countries would embrace the liberal democratic model. For all Krugman’s criticism, Estonia has easily the highest GDP per capita in the former USSR.

Ilves, who cut his teeth as a politician in the 1990s pushing for Estonia to join the EU, bristles at those comparisons — he refers to Russia as “that country” and asked not to discuss it in our interview — and prefers to compare his country to Finland, whose language is related to Estonian. He cites data offhand from 1939, noting that is before “this” happened, meaning Soviet control over Estonia. He asks an aide to compare the two countries’ economies on his iPhone 5. When the Soviet Union collapsed in 1991, there was a 20-fold difference in GDP per capita; now, he boasts, the distance is a mere 2.5. He ascribes much of that to his assertion that Estonians never wanted to be communist in the first place.

“The Soviet Union collapsed without a lot of people thinking it should or would, whereas for Estonia it was something we’d been praying for for 60 years,” he says. “In Estonian society you had this thing, ‘Now this is our chance to do all that we would have done had we not had this crap.’”

Embracing the internet early on has given Ilves and Estonia a prominence its Baltic neighbors, Latvia and Lithuania, lack, though all three are members of the EU and NATO. It has also made Estonia a target. In 2007, the country suffered a massive, highly sophisticated cyber attack on its government, banking system, and media that threatened to cripple its digital infrastructure. Russia, tussling with Estonia at the time over its decision to move a Soviet-era World War II monument, is widely thought to have been behind the attacks, though culpability has never been proven.

That experience has helped attune Ilves to broader internet security issues. He requires all his staff to read Viktor Mayer-Schönberger and Kenneth Cukier’s Big Data, as well as Robert M. Lee’s SCADA and Me, a picture book about computer systems that control industry and infrastructure subtitled “For Children and Management.” It has also made him something of an authority. Ilves frequently lectures around the world on cybersecurity issues and published an op-ed on the subject in The New York Times in April.

“Everyone should realize that the internet is not particularly secure. But I knew that beforehand!” he says. “You can devastate a country, render it inoperable, and never engage with the military. All you have to do is shut it down,” he says. “Imagine if you turn all the lights in Manhattan during rush hour red. What happens? Or even more dangerous, turn all the lights green!’

The rest of the world may be starting to catch on. Snowden’s revelations have brought internet security issues to the top of the global agenda. EU countries cried foul after the NSA was found to be spying on them, while Brazil’s president Dilma Rousseff canceled her state visit to the U.S. and wants to mandate all countries to locate servers with information on Brazilian citizens in Brazil. Ilves opened a high-level, Estonian-organized side event at the UNGA on internet issues and is keen to maintain that outsized influence.

“This entire self-pitying attitude, ‘Oh, we’re just backward Estonians,’ and then you see that with a little bit of brains, with a little bit of creativity, you actually can go far beyond your borders,” he says. “With brains, you can do a lot.”