Many of the thousands of mourners who gathered Thursday at the Capitol to honor the life of longtime congressman Elijah E. Cummings remembered his frequent refrain, “We can do better!” and prayed his legacy would live on.

“This is a sad day for us, because the world lost a great and powerful black man,” said Jean Bockry, an Oxon Hill, Md. , resident who said she had watched Cummings on television recently and worried that he looked sick. “May his soul rest in peace. I know the Lord is saying, ‘Well done, my good and faithful servant.’ ”

The Baltimore Democrat was the first African American lawmaker in history to lie in state in the Capitol, an honor that has been afforded to about 20 former senators, representatives and presidents, according to House historians.

Two other African Americans have received the honor: civil rights icon Rosa Parks, in 2005, and Capitol Police Officer Jacob J. Chestnut Jr., who was killed in 1998 by a gunman who had burst into the Capitol.

Lawmakers from both chambers and both parties paid tribute to Cummings at a late-morning ceremony in a packed Statuary Hall.

Members of the public streamed through the building for six hours to view his flag-draped coffin at the entrance to the House chamber, where he served for 23 years.

Although he had battled illness for more than two years, Cummings’s death at age 68 came as a shock to many, including Joseph Gibson, 50, a State Department employee and Army veteran who stood in line to pay his respects.

When the Ellicott City, Md., resident risked losing his dental benefits, he called Cummings’s office. The congressman personally returned the call, and within two days he had an appointment.

“Love the man,” Gibson said simply.

As chairman of the Oversight and Reform Committee, Cummings was a leading figure in the Trump impeachment inquiry. Jade Brown, 17, who came to the Capitol with a group of students from Baltimore City College, Cummings’s alma mater, said the congressman’s death had left her paralyzed.

“You think to yourself, ‘Where do we go from here?’ ” she said. “We worry we’re going to get someone who will just roll over, and that’s the last thing we need.”

Earlier in the day, members of the House and Senate lauded Cummings as a public servant who spoke truth to power and put constituents first.

House Majority Leader Steny H. Hoyer (D-Md.) said Cummings was the moral backbone of Congress, a leader who — like the prophet whose name he shared — “saw wrongdoing and spent his life working to banish it from our land.”

House Speaker Nancy Pelosi (D-Calif.) described Cummings as a mentor to generations of young political leaders, quoting a favorite line of his: “Children are the living messages to a future we will never see.”

“Elijah was truly a master of the House,” Pelosi said. “He respected its history, and in it he helped shape America’s future.”

Several hours later, outside the House chamber, Pelosi and Rep. John Lewis (D-Ga.) approached the coffin from opposite sides. Pelosi moved aside a velvet rope, and the pair met at the base of the coffin, where Lewis put his arm around her.

Recalling Cummings’s efforts to calm rioting in 2015 after the funeral of Freddie Gray, a young black man who was fatally injured in police custody, Senate Majority Leader Mitch McConnell (R-Ky.) said, “Elijah Cummings did not just represent Baltimore, he embodied it.”

Senate Minority Leader Charles E. Schumer (D-N.Y.) said Cummings was “universally respected and admired in a divided time,” with power that came not from his booming baritone but from his moral force.

“He was strong, very strong when necessary, but also kind and caring and honorable,” Schumer said. “His voice could shake mountains, stir the most cynical hearts, inspiring us all to do better.”

Vice President Pence, a former Republican member of the House from Indiana, and Attorney General William P. Barr came to pay their respects.

Rep. Mark Meadows (R-N.C.) said some classified his close friendship with Cummings as unexpected because they came from opposite sides of the political spectrum. But those who knew Cummings’s heart, he said, understood their bond.

“He had a smile that could consume his whole face. But he also had eyes that would pierce through anybody that was in his way,” Meadows said. Later, tears in his eyes, Meadows joined Pence to visit Cummings’s coffin.

Rep. Emanuel Cleaver II (D-Mo.) called Cummings “the bootlegging preacher based in Baltimore,” eliciting a bout of laughter that broke the tension in the otherwise solemn morning ceremony.

Dozens of members of the Congressional Black Caucus gathered around the coffin at one point, bowing their heads in prayer. Some draped arms around one another. “Amen,” they said aloud, then lingered for a few more moments.

After the ceremony, Cummings’s coffin was placed on the catafalque at the entrance to the House chamber, while his widow, Maryland Democratic Party Chair Maya Rockeymoore Cummings, looked on.

The catafalque is a platform built in 1865 to support the casket of Abraham Lincoln, when his body lay in state in the Rotunda. A base of rough pine boards is nailed together and covered in a black cloth.

Mourners also honored Cummings on Wednesday at a day-long celebration at Morgan State University in Baltimore, where he served on the board of regents.

More than two dozen speakers took turns at a lectern directly behind the casket, which was guarded by Prince Hall Freemasons. Local, state and federal elected officials praised Cummings as a champion who expanded health-care access, protected the right to vote and fought for educational opportunities for children.

Former senator Barbara A. Mikulski, who retired in 2016 as the nation’s longest-serving female senator, said Cummings could “investigate, legislate and agitate” and inspired a feeling of connection with every man and woman in his beloved city.

“I’m back!” she told the crowd. “I’m back for Elijah. And Elijah always had my back, and Elijah always had your back, too.”

Mourners said they would remember Cummings as a man who always fought for his city and its people.

“He spoke for the forgotten,” said Emanuel J. Stanley, grand master of the Most Worshipful Prince Hall Grand Lodge of Maryland, a national fraternal organization to which Cummings belonged. “Now he is dancing with the angels.”

Cummings’s funeral is scheduled for Friday at New Psalmist Baptist Church in West Baltimore, where the congressman worshiped for decades. Former presidents Barack Obama and Bill Clinton and former secretary of state Hillary Clinton are among those who are scheduled to give remarks.

Rep. Elijah E. Cummings’s casket arrived at the Capitol on Oct. 24. The civil rights activist died Oct. 17. (The Washington Post)