Chief Justice John G. Roberts Jr. eulogized Ruth Bader Ginsburg as a “rock star” whose legal victories as a crusading lawyer for women’s rights and decisions over 27 years on the Supreme Court moved the nation closer to the goal of “equal justice under law.”

“Among the words that describe Ruth: Tough. Brave. A fighter. A winner,” a red-eyed Roberts said during a ceremony in the Supreme Court’s Great Hall. “But also: Thoughtful. Careful. Compassionate. Honest.”

Dozens of black-clad former clerks lined the steps of the marble building as Supreme Court police officers delivered Ginsburg’s coffin to the Great Hall, where justices traditionally have been remembered.

The brief ceremony presented a snapshot of 2020 at the court. All eight justices — plus retired justice Anthony M. Kennedy and Maureen Scalia, the widow of Ginsburg’s friend and fellow justice Antonin Scalia — wore masks. Justice Sonia Sotomayor added a clear plastic face shield; Justice Samuel A. Alito Jr. looked as if he had been skipping haircuts.

The justices dispersed to home offices in March when the coronavirus pandemic closed the court, and when they returned Wednesday, they stood apart from one another. Justice Clarence Thomas was to Roberts’s right, and Justice Stephen G. Breyer, 82 and now the second-longest-serving justice after Thomas, took Ginsburg’s usual spot at the chief justice’s left.

A few family members and close friends gathered for words from Rabbi Lauren Holtzblatt, whose husband, Ari, is among 159 former clerks who served Ginsburg in her more than 40 years as a justice and an appeals court judge.

Roberts said the loss of the 87-year-old jurist, who died Friday of complications from cancer, was most heavy on her family, which includes daughter Jane and son James.

“But the court was her family, too,” Roberts said. “This building was her home, too. . . . Ruth is gone, and we grieve.”

Roberts touched on the justice’s famous love of opera.

“It has been said that Ruth wanted to be an opera virtuoso but became a rock star instead,” Roberts said, adding, “She found her stage right behind me in our courtroom.”

As a lawyer in the 1970s, Ginsburg argued six cases in the Supreme Court, helping to chip away and eventually topple the legal wall of gender inequality. Roberts noted that she wrote 483 opinions and dissents in her tenure, a legacy that will “steer the court for decades.”

The chief justice, a man a generation younger than Ginsburg who attended Harvard Law School with her daughter, said the justice’s life was “one of the versions of the American Dream.”

Ginsburg’s father was an immigrant, and she used to say her mother was conceived in the Old World and born in the New World. She had worked as a bookkeeper in Brooklyn.

“Ruth used to ask, ‘What is the difference between a bookkeeper in Brooklyn and a Supreme Court justice?’ ” Roberts said. “Her answer: ‘One generation.’ ”

After the ceremony inside the court, Ginsburg’s flag-draped coffin was moved to the court’s portico, where it will remain for two days of public viewing.

The White House said President Trump will visit Thursday. On Friday, Ginsburg will lie in state at the U.S. Capitol, the first woman to receive the honor.

There, political maneuvering to replace Ginsburg is well underway; Trump has said he will nominate a woman to take her place, while Democrats call it unfair to make such a replacement when voting in the presidential election already has begun.

But it was somber and quiet in front of the Supreme Court, often the scene of loud demonstrations when the justices are hearing a particularly controversial issue.

While in the recent past, justices have lain in repose for one day, the extraordinary services planned for Ginsburg recognize the importance of the second woman to serve on the high court and one who, in her 80s, became something of a cultural icon.

Her coffin was placed on the Lincoln catafalque, built for President Abraham Lincoln’s coffin in 1865, and surrounded by an arrangement of the justice’s favorite flowers, including white hydrangea, freesia and white tea roses.

By 11:30 a.m., hundreds of people — families and couples and groups of friends of all ages — stood in line, wearing hats and masks and RBG shirts, waiting for their chance at a brief stroll in front of the coffin.

The entire block of East Capitol Street between 1st and 2nd streets, which was cordoned off with metal gates for the winding line, was packed. The line of people spilled onto the sidewalk down 2nd Street, stretching all the way to the far corner of the back parking lot of the Library of Congress.

Some had been waiting for hours. By dawn Wednesday, a dozen people were already waiting. Four of them had spent the night outside the court, dozing on camping chairs.

“She’s touched every aspect of our lives,” said Mary ­Migues-Jordan, a 55-year-old attorney from Maryland who was the first in line beside her wife, Vicki. They arrived at 9:45 Tuesday night. “People keep asking me if I’m okay, because they know how much she means to me.”

Behind them, the line grew as the sun rose, with lawyers, college students, a Coast Guard officer and a counselor settling in on the sidewalk. They came from as far as Vermont and Louisiana, flying and driving all night to be here for this moment.

“When I was a younger man, I waited out all night for concert tickets,” said Doug Smith, 53, who had arrived from Pennsylvania at 10 p.m. with his daughter. “And this woman is a definition of a rock star. So, yeah, waiting out all night for her? I can do that.”

The viewing resumes Thursday at 8:30 a.m.