Once elected, officials earn the title of "Honorable," and in his eulogy of the late Democratic Congressman Elijah Cummings, President Obama talked about those who deserve it and those who don't. Cummings, he said, was the very definition of the word.

"This is a title that we confer on all kinds of people who get elected to public office," Mr. Obama said to laughs and claps. "We're supposed to introduce them as 'honorable.' But Elijah Cummings was honorable before he was elected office. There's a difference. There's a difference if you were honorable and treated others honorably outside the limelight."

The former president's remarks appeared to target — albeit without naming — President Trump, who succeeded him in the presidency and who has been accused of sexual misconduct and fraud and of using divisive language on issues of race. In tweets in recent weeks, Mr. Trump also targeted Cummings, who was a key figure in the impeachment inquiry launched against him.

Get Breaking News Delivered to Your Inbox

Mr. Obama praised Cummings for his humanity.

"Being a strong man includes being kind," he said. "There's nothing weak about kindness and compassion. ... You're not a sucker to have integrity and to treat others with respect."

Former President Obama speaks during the funeral services for late Representative Elijah Cummings. Julio Cortez / Getty Images

Cummings's presence in Congress mattered most during the hardest times, Mr. Obama said: "I would watch Elijah rally his colleagues. 'The cost of doing nothing is nothing,' he would say. And folks would remember why they entered into public service."

Mr. Obama told the crowd that there were lessons to be learned from Cummings, who grew up the son of a sharecropper.

"His life validates the things we tell ourselves about what's possible in this country...the possibility that our destinies are not preordained," he said.

The former president, who was the nation's first African-American elected to the White House, urged people to honor Cummings by continuing his legacy.

"It falls upon each of to give voice to the voiceless, and comfort to the sick, and opportunity to those not born to it, and to preserve and nurture our democracy," he said.

Mr. Obama's remarks echoed what Cummings told The Baltimore Sun about his conversation with President Trump in 2017: "'Mr. President, you're now 70-something, I'm 60-something. Very soon you and I will be dancing with the angels. The thing that you and I need to do is figure out what we can do — what present can we bring to generations unborn?'"

Cummings died on October 17 at the age of 68. Before serving in Congress for 23 years, he was elected to the Maryland House, where he became the first black speaker pro tem of that chamber.