Pavel Durov’s grand cryptocurrency dreams for his Telegram messaging service are ending with an $18.5 million civil settlement with the U.S. Securities and Exchange Commission and a pledge to return the more than $1.2 billion that investors had put into its TON digital token.

The settlement ends a months long legal battle between the company and the regulator. In October 2019 the SECĀ filed a complaint against Telegram alleging the company had raised capital through the sale of 2.9 billion Grams to finance its business. The SEC sought to enjoin Telegram from delivering the Grams it sold, which the regulator alleged were securities. In March, the U.S. District Court for the Southern District of New York agreed with the SEC and issued a preliminary injunction.

In May, Telegram announced that it was shutting down the TON initiative.

Announcing that TON was being shut down, Durov wrote:

I want to conclude this post by wishing luck to all those striving for decentralization, balance and equality in the world. You are fighting the right battle. This battle may well be the most important battle of our generation. We hope that you succeed where we have failed.

In its own announcement of the settlement, the SEC differed with Durov’s assessment of its actions.

“New and innovative businesses are welcome to participate in our capital markets but they cannot do so in violation of the registration requirements of the federal securities laws,” said Kristina Littman, chief of the SEC Enforcement Division’s Cyber Unit, in a statement. “This settlement requires Telegram to return funds to investors, imposes a significant penalty, and requires Telegram to give notice of future digital offerings.”

The argument from the regulator is that Telegram didn’t follow the rules. Had it worked with the regulator instead of launching the token offering without any oversight, the outcome might have been different, according to the SEC.

“Our emergency action protected retail investors from Telegram’s attempt to flood the markets with securities sold in an unregistered offering without providing full disclosures concerning their project,” said Lara Shalov Mehraban, associate regional director of the New York Regional Office. “The remedies we obtained provide significant relief to investors and protect retail investors from future illegal offerings by Telegram.”