 In 1878, he ran for Congress and won, but his white opponent was ruled the winner by corrupt public officials.In 1882, O'Hara was elected as a Republican member of the United States House of Representatives from North Carolina's 2nd congressional district, where there was a black majority.He served two terms.