After the Civil War, James O’Hara taught at freedman’s schools in New Bern and Goldsboro, North Carolina. O"Hara also studied law at Howard University in Washington, D.C. Shortly after North Carolina’s 1868 Constitutional Convention which reorganized state government and authorized black male voting, O"Hara was elected to the North Carolina state legislature. In 1871, while still in the legislature, he completed his law apprenticeship and passed the North Carolina bar exam. In 1878 O’Hara won the Republican nomination for North Carolina’s heavily black Second Congressional District. He lost the general election to white Democrat William Hodges Kitchin. Four years later, in 1882, O"Hara again faced Kitchin and won the election by 18,000 votes. He was reelected in 1884.