Their parents and defense lawyers accuse the government of fabricating a case so the girls would run afoul of the anti-extremism law. The girls, both animal lovers, had gone on the Telegram messaging service to meet friends, especially boyfriends, the parents and defense lawyers said in an extensive record of the case compiled by Mediazona, an online news service.

Last fall, they let an older man join their chat room, and he gradually steered the group into politics, renting an office, buying a printer and drafting an anti-government manifesto. The older man then gave 10 pages of testimony against members of the “New Greatness” group, but he has never been thoroughly identified in court documents.

Defense lawyers and the families think the mysterious witness was an agent of the FSB, the successor agency of the K.G.B.

In the hours before the march, officials appealed to the court to move the girls to house arrest, according to Russian news reports, but many marchers dismissed the move as a ploy to get them to stay at home.

“It is an unconscionable case against children, and that is why people are reacting,” Yulia Pavlikova, Anna’s mother, told reporters at the march. “I really hope that they heard us, they saw us and some kind of action has begun. Children should not be in prison, especially when they are not guilty.”

Ms. Pavlikova and Ms. Dubovik’s mother had earlier made a tape appealing to President Vladimir V. Putin to intercede in the case, wondering aloud if the security services really had nothing better to do than to arrest adolescents.

Asked Tuesday about the spread of extremism cases, Dmitri S. Peskov, the spokesman for Mr. Putin, said that some such cases fell “beyond the bonds of reason.”