In 2014, he quit the Montana attorney general’s office to run for state Supreme Court, in what turned out to be a bitter contest inflamed by record independent expenditures.