Prior to the war , he was a lawyer , public official , and politician in Hillsborough , North Carolina , and was heavily involved in opposing the Regulator movement , an uprising of settlers in the North Carolina piedmont between 1765 and 1771 .