In 1859, Republicans in the House and Senate presented a nearly united but puzzling front on a crucial issue of the day. The new anti-slavery party opposed the admission of the free state of Oregon to the Union. To be sure, Republicans praised the proposed state constitution’s opposition to slavery. But the same document also barred Blacks from coming to or residing in the state, and provided further that Blacks could never “hold any real estate, or make any contract, or maintain any suit thereon” in the state’s courts. Republicans in Congress — all of them White — denounced such rules. Free Black people, they insisted, should be treated as citizens entitled to basic civil rights.

Kate Masur’s momentous new book, “Until Justice Be Done: America’s First Civil Rights Movement, From the Revolution to Reconstruction,” sets out to explain how an antislavery effort became a civil rights project. The two did not always go together. For decades, historians have emphasized the ways in which antislavery advocacy before the Civil War protected free soil for free White men. Antislavery politics often went hand in hand with racism, not race equality.

Against this backdrop, Masur wants to know what led increasingly influential politicians to adopt the view that Black people ought, as Rep. Henry Dawes of Massachusetts put it in the Oregon debate, to “have all the rights and privileges and immunities” that “every citizen” had. In Masur’s account, the answer is a now-forgotten social mobilization of Black civil rights advocates who fought alongside White allies not only to undermine slavery but to establish basic equality for Blacks in the free states of the North.

Masur’s story begins in the Northwest Territory, where the Continental Congress abolished slavery in 1787. The end of slavery did not mean equal freedom. After statehood in 1803, Masur writes, the new state of Ohio “erected barriers to Black migration and settlement.” State law required Blacks to register and provide proof of their free status; newly arrived Blacks were required to provide $500 bonds guaranteeing that they would not become public charges. No Black person was allowed to testify in cases involving a White litigant.

Indiana and Illinois soon followed the Ohio pattern. Active free Black communities, led by men such as the brilliant Philadelphia sailmaker James Forten, managed to prevent the most extreme of such laws from sweeping into states such as Pennsylvania and New York. But the worst was yet to come.

In 1821, the Missouri state constitution banned the entry of free Blacks altogether. Ohio prohibited newly arriving Blacks from becoming eligible for poor relief. South Carolina’s infamous Negro Seamen Act ordered free Black sailors in the state’s ports to be jailed until their vessels were ready to depart. The federal Fugitive Slave Act of 1850 increased the vulnerability of free Blacks to kidnapping. When Illinois banned the entry of Blacks in 1853, a wave of White pogroms followed.

Fearsome violence swirled around the grim drumbeat of anti-Black laws in ostensibly free states. White mobs drove Black families off their land, destroying Black neighborhoods and attacking Black churches. Laws prohibiting Blacks from testifying often made White attackers effectively immune from prosecution. Such rules left Black women without recourse against White rapists. Freedom without equality reproduced some of slavery’s most brutal conditions.

Paradoxically, the “Black codes” arose out of the so-called police power of the states to care for the health and welfare of their people. In practice, that meant the welfare of White people, which states aimed to protect from what one White South Carolina lawyer called “the moral contagion” of free Black people.

Masur’s heroes are the social activists, African Methodist Episcopal Church leaders and Republican politicians who challenged the racist laws enacted under the police power. In addition to Forten in Philadelphia, Masur recounts the efforts of figures like Frederick Douglass as well as less-familiar people such as Samuel Cornish, a Black minister in New York, and William Costin, a Black activist in D.C. In Ohio we meet newspaper editor David Jenkins, lawyer John Mercer Langston and educator William Howard Day. Mary Ann Shadd, a Canadian newspaper publisher descended from free Blacks in the Chesapeake, toured the Upper Midwest and lectured on race and women’s equality. White Northern allies took up ideas about equality and civil rights, too, sometimes at considerable personal cost.

Advocates for the equality of free Blacks in antebellum America mobilized the language of the Declaration. All men, they asserted, were created equal. Even more important, they found a resource in the “privileges and immunities” clause of Article IV of the Constitution, which provided that the “citizens of each state shall be entitled to all privileges and immunities of citizens in the several states.” Advocates took this obscure language and insisted that it prohibited the Black codes in Missouri, Ohio, Illinois and other states. They used it to challenge the South Carolina seamen’s law and the fugitive proceedings that denied free Black citizens due process.

Masur’s book illuminates just how much was at stake in the fight over Black citizenship. Because of the “privileges and immunities” clause, citizenship was the key to asserting rights of contract, the right to sue and be sued, and basic freedom of movement. Chief Justice Roger Taney’s infamous opinion in Dred Scott v. Sandford tried to resolve the political debate over slave states in the West. Masur’s account helps us see that Taney aimed to fix not only the increasingly bitter controversy over slavery but also the battle over Black civil rights. By asserting that Blacks were not and could never be citizens, Taney indicated that the Black codes of the West, Midwest and South would almost surely be constitutional and that Black people would have no rights that Whites were obliged to respect.

Masur’s fresh perspective lets us see famous episodes in a new light. The Lincoln-Douglas debates appear as a struggle over Black civil rights and citizenship in the old Northwest Territory, one precipitated by the Black codes and the civil rights movement they triggered. Abraham Lincoln’s first inaugural address in March 1861, with its call for Congress to amend the Fugitive Slave Act, stands as the culmination of decades of political mobilization by civil rights advocates fighting for the equal protection of free Black people. In turn, the Black codes of 1865, promulgated by Southern states seeking readmission to the Union, reproduce the experience of Ohio, Illinois and Indiana.

The first civil rights movement achieved its greatest victory in the 14th Amendment, ratified in 1868, which overturned the Black codes and wrote decades of civil rights activism into the Constitution. Crafted by Sen. John Bingham, one of the Republicans who had dissented from the admission of Oregon as a free but White state in 1859, the amendment’s first section established birthright citizenship for all Americans and purported to guarantee the privileges and immunities, and the equal protection of the laws, that civil rights advocates had pursued for so long.

Masur’s story ends with the slow demise of the legal formations put in place by the 19th-century civil rights movement. In her account, the Supreme Court decision in the 1873 slaughterhouse cases, which upheld a Louisiana public health law restricting butchering operations to a single facility, was an early blow. The cases restored the old police power that had sustained the Black codes of the Northwest Territory. In the slaughterhouse cases, the plaintiffs were White butchers protesting a law enacted by a mixed-race Republican legislature. But Black power in Southern statehouses was short-lived. The reestablishment of White rule in the South soon led to a wave of discriminatory new laws. The Supreme Court facilitated such laws, repeatedly striking down efforts to extend federal power against racist state statutes while limiting states’ ability to enact civil rights measures.

Masur’s book is a brilliant meditation on progress and its limits. Activists creatively targeted weak spots in the Constitution. In the 14th Amendment, they essentially established a second American republic.

Yet the temporary successes of civil rights activists in gaining new laws was no guarantee of equal treatment. One hundred years later, in the 1950s and 1960s, a second civil rights movement would confront race inequality again. Today, advocates in the Black Lives Matter movement are keen to avoid the mistakes of their predecessors. But Masur’s monumental account leaves no doubt that a generation of 19th-century racial egalitarians altered history. They forced white supremacists to change course, and they created resources used ever since by advocates in the fight for equality.

Until Justice Be Done

America’s First Civil Rights Movement, From the Revolution to Reconstruction

By Kate Masur

456 pp. $32