AUSTIN, Texas – President Obama on Thursday paid tribute to the Civil Rights Act a half century after its passage transformed American society and ultimately paved the way for the day when the United States might have an African-American serve in the Oval Office.

In a much-anticipated speech at the Lyndon B. Johnson Presidential Library and Museum marking the 50th anniversary of the landmark law, Obama said the push for equality and liberty had opened doors of opportunity for millions of Americans.

“They swung open for you, and they swung open for me,” he said. “That’s why I’m standing here today.”

Obama said champions of civil rights should not succumb to cynicism in a cynical age. “Yes, it’s true that despite laws like the Civil Rights Act and the Voting Rights Act and Medicare, our society is still wracked with division and poverty,” he said. “Yes, race still colors our political debates, and there have been government programs that have fallen short.”

But, he added, “I reject such cynicism because I have lived out the promise of LBJ’s efforts, because Michelle has lived out the legacy of those efforts, because my daughters have lived out the legacy of those efforts.”

Speaking at a conference commemorating the law signed in July 1964, Obama lavished praise on Johnson, a leader to whom disappointed liberals sometimes compare him unfavorably. “He was charming when he needed to be, ruthless when required,” Obama said. “He could wear you down with logic and argument, he could horse trade and he could flatter.”

He went on to say: “President Johnson liked power. He liked the feel of it, the wielding of it. But that hunger was harnessed and redeemed by a deeper understanding of the human condition, by a sympathy for the underdog, for the downtrodden, for the outcast. And it was a sympathy rooted in his own experience.”

Obama implicitly linked his own health care program to the legacy of Johnson’s creation of Medicare and Medicaid. Describing Johnson’s legislative accomplishments, Obama noted with a sly tone that the former president had created “a health care law that opponents described as socialized medicine.”

Obama and his wife, Michelle Obama, toured the museum before his speech, accompanied by Rep. John Lewis, D-Ga., the civil rights era icon. Mark K. Updegrove, the library director, showed the president copies of the Emancipation Proclamation, the 13th Amendment ending slavery, which was signed by Abraham Lincoln, and the Civil Rights Act and Voting Rights Act signed by Johnson.

The president met with Johnson’s two daughters, Luci Baines Johnson and Lynda Bird Johnson Robb. Also on hand were veterans of the civil rights movement such as Julian Bond, the former NAACP chairman; Maria Shriver, the niece of President John F. Kennedy; and former Sen. Charles S. Robb, Johnson’s son-in-law.

The auditorium felt a little like a time capsule. As the audience waited for the president, a loop of 1960s anthems featuring artists like Bob Dylan and songs like “Abraham, Martin and John” played. A black and white video with scratchy recordings of Johnson recalled the moment he signed the Civil Rights Act, and a photo montage recalled the famous, and infamous, moments of the era, then traced the progress of race relations all the way to Obama’s presidency.

The crowd stood for the gospel singer Mavis Staples, who performed “We Shall Overcome.”

The event comes at a time when issues of rights and discrimination continue to shape the national debate. Obama has presided over a period of rapid change in the acceptance of gay and lesbian couples.

Though Obama often seemed reluctant to be drawn into discussions of race relations in his first term, he has seemed more open in talking about it since winning re-election. He made unusually passionate and personal comments after the shooting of Trayvon Martin in Florida and created an initiative called My Brother’s Keeper to help young black men.

He has also been more vocal about issues like voting rights and equal pay for women.

Obama’s inauguration was supposed to usher in something of a post-racial era but has not quite done so. Many Democrats argue that the vociferous opposition to his policies is too often rooted in hidden racism, while some conservatives maintain that Obama’s supporters use race to shield him from criticism.