MOSCOW — After a two-day trial conducted behind closed doors, the Moscow City Court on Thursday sentenced Vladimir Anikeyev, the head of a hacking group that the authorities cracked down on last winter, to two years in a penal colony.

The state prosecutor had asked for a sentence of two and a half years.

Mr. Anikeyev, a former journalist who led a collective known as Shaltai Boltai — Humpty Dumpty — until his arrest last November, admitted his guilt in illegally gaining access to the private data of a number of targets, including high-ranking officials, businessmen and journalists, according to Russian news reports.

His cooperation with law enforcement made a swift trial possible, but the involvement of classified information meant it was closed to the public.

Among those whose email inboxes and mobile phones are said to have been penetrated are Natalya Timakova, the spokeswoman for Dmitri A. Medvedev, the prime minister and former president; Arkady Dvorkovich, a deputy prime minister; Andrei Belousov, an adviser to President Vladimir V. Putin and a former minister of economic development; and Dmitri Kiselyev, the Russian government’s chief propagandist.