Fifty years ago today, President Lyndon Johnson signed into law the Civil Rights Act of 1964 with a speech in which he drew a direct comparison between the bill he was signing and the legacy of the founding fathers.

“One hundred and eighty-eight years ago this week a small band of valiant men began a long struggle for freedom,” Johnson told the nation during a nationally televised signing ceremony held in the East Room of the White House just hours after the House of Representatives had approved changes made by the Senate in the Civil Rights Bill by a vote of 289 to 126.

Johnson had asked the networks for airtime at 7 p.m. Their executives had said they preferred 6:45, and Johnson had acceded to their wishes rather than force them to alter their prime time, evening schedules. A year earlier the CBS Evening News with Walter Cronkite and The Huntley-Brinkley Report on NBC had expanded to a half-hour. Johnson knew he was sure to get their viewers as well as those of ABC News, which had a 15-minute program anchored by Ron Cochran that began at 6:45.

The president wanted maximum exposure for his speech, and he had already decided that postponing the White House signing ceremony for the Fourth of July, which fell on a Saturday in 1964, would be a mistake.

Johnson’s determination to sign the Civil Rights Act as quickly as possible reflected his worry over the emotions surrounding its passage. The president wanted to make sure those who favored the act as well as those who opposed it did not have time to plan demonstrations that might draw attention from the momentousness of the legislation itself.

From public accommodations in hotels and restaurants to hiring in the workplace, the Civil Rights Act of 1964 outlawed discrimination. The act even gave the federal government new power to enforce school desegregation through the aid to education it provided. Not since Reconstruction had the country changed so dramatically with regard to race and the law.

The president was aware of the difficulties he had made for himself as a result of his advocacy of the Civil Rights Act. “I think we just delivered the South to the Republican Party for a long time to come,” he told Bill Moyers that night after the euphoria of the signing ceremony had worn off.

Johnson also realized how much he owed those who had helped him get the Civil Rights Bill passed over the opposition of the very Southern Democrats he had once been close to. The president brought over 70 pens to the signing ceremony. One of them went to Martin Luther King Jr., but there was a large supply of pens earmarked for the senators and representatives Johnson had relied on for a bill he considered signature legislation.

As Todd Purdum has shown in his new book, An Idea Whose Time Has Come: Two Presidents, Two Parties, and the Battle for the Civil Rights Act of 1964, Republican support was crucial in overcoming Southern opposition to the Civil Rights Bill. The Democrats did not by themselves have the votes to defeat a Southern filibuster in the Senate. In the Senate, 27 of 33 Republicans voted for the bill as compared with 46 of 67 Democrats. In the House, 136 of 171 Republicans voted for the final bill as compared to 153 of 244 Democrats.

It was no accident that the first pen Johnson gave on signing the Civil Rights Act went to Republican Senate Minority Leader Everett Dirksen of Illinois, and that soon after Dirksen received his pen, another pen went to Ohio Republican Congressman Bill McCulloch, a key member of the House Judiciary Committee.

The Civil Rights Act of 1964 had its origins in a speech President Kennedy delivered on June 11, 1963, following his administration’s clash with Alabama’s segregationist governor George Wallace over the admission of two black students to the University of Alabama.

“We are confronted primarily with a moral issue,” Kennedy told the country in his civil rights address. “It is as old as the scriptures and as clear as the American Constitution. The heart of the question is whether all Americans are to be afforded equal rights and equal opportunities.”

During Kennedy’s lifetime, his civil rights speech did not become the racial turning point he had hoped it would be. Instead, his speech was followed by a new wave of white-on-black violence. The following day, Medgar Evers, a field secretary for the Mississippi NAACP and a World War II veteran, was shot in the back while entering his house in Jackson, and on September 15, after the successful March on Washington and Martin Luther King’s “I have a dream” speech, Southern diehards struck again, dynamiting the Sixteenth Street Baptist Church in Birmingham, Alabama, and killing four black girls who had been attending Bible class.

As the summer of 1964 began and the Civil Rights Bill moved through Congress, the violence that was so conspicuous in 1963 continued. On June 21, three civil rights workers, James Chaney, Andrew Goodman, and Michael Schwerner, disappeared in rural Mississippi (they would later be found shot and buried in an earthen dam) just as a voter registration program—Mississippi Freedom Summer—that relied primarily on college students was beginning.

In the midst of this mix of competing forces, Senator Dirksen insisted that those opposing the Civil Rights Act of 1964 were doomed to defeat. “Stronger than all the armies is an idea whose time has come,” Dirksen declared. In retrospect, though, nothing about the history of the Civil Rights Act of 1964 suggests its passage was inevitable. A half-century later, what is most memorable are the risks so many in public and private life were willing to take in order to see the Civil Rights Act become law.

A year later, President Johnson and his congressional allies still had the power to add to their civil rights legacy by passing the Voting Rights Act of 1965, but the consensus that had been reached in the country on civil rights would not last. The six-day Watts riots that took place in Los Angeles in August 1965, the black power movement that began in 1966, the assassinations of Robert Kennedy and Martin Luther King in 1968, along with the Vietnam War, soon made July 2, 1964, seem like nothing so much as a political miracle.

Nicolaus Mills is professor of American Studies at Sarah Lawrence College and author of Like a Holy Crusade: Mississippi 1964—The Turning of the Civil Rights Movement in America.