MOSCOW — The funeral on Tuesday for Boris Y. Nemtsov, the assassinated Kremlin critic, drew a gloomy band of politicians and supporters from the faltering liberal opposition, with mourners grieving that they were burying not just a friend, but also their dream for a different Russia.

“Now that he is in the grave, the last hope for Russia is in the grave,” said Vladimir N. Voynovich, a famous Russian novelist who, like Mr. Nemtsov, has been outspoken in criticizing Russia’s role in the war in Ukraine. “He was one of the last optimists in this country.”

Thousands of Muscovites bearing flowers and red votive candles lined up early in the morning to pay their final respects to Mr. Nemtsov, 55, whose body lay in an open coffin at the Sakharov Center. By early afternoon, hundreds still clogged the sidewalk outside as the coffin was transferred to a hearse for the long ride to the pine-covered Troyekurovskoye Cemetery, filled with the black granite headstones favored by the city’s elite.

Mr. Nemtsov was once one of President Boris N. Yeltsin’s bright young things, among the mavericks brought into the Kremlin to force the transition from centrally planned communism to capitalism in the early 1990s.