Stumbo was elected as Attorney General in November 2003, taking office in January 2004. Stumbo's office led an investigation into the hiring practices of Kentucky Republican Governor Ernie Fletcher which resulted in indictments, but was dismissed by agreement with the prosecutors. On September 12, 2007, Stumbo sued Fletcher for appointing too many Republicans to the governing bodies of state universities. State law requires "proportional representation of the two leading political parties" based on voter registration. A majority of registered voters in Kentucky are Democrats, but Fletcher appointed seven Republicans and two Democrats to the University of Kentucky and eight Republicans and two Democrats to the University of Louisville. Stumbo was also, in his time as Attorney General, known for leading a somewhat controversial and very effective attack on the sale of prescription drugs over the internet and through "pill mills", which led to the most stringent laws preventing these sales in the nation. The Ryan Haight Act, the federal law that prohibits the internet-only-based sale of narcotic prescription drugs by these same websites was modeled on the law Stumbo passed in Kentucky. A large part of the controversy surrounding Stumbo's efforts to control the sale of internet "prescriptions" was based in the objections of other states, who saw Stumbo's efforts intruding on their own state sovereignty and authority, particularly in the states where the internet pharmacy sites were based. Stumbo also faced considerable criticism from pain patient's rights groups, particularly The Pain Relief Network and its president, Siobhan Reynolds, who threatened to file lawsuits challenging the constitutionality of the proposed law. The suit was never filed and the law became the first in the nation requiring registration of internet pharmacies, wherever they were located, in the state in order for them to deliver any medication to Kentucky. In 2019, Stumbo became the Democratic nominee for Attorney General once again, running unopposed in the Democratic primary. His major party opponent is Daniel Cameron, a lawyer in private practice who had won the Republican primary. Cameron had worked for two years, beginning in 2011, for U.S. Senator Mitch McConnell. Cameron told The Courier-Journal on December 21, 2018 that, if elected, he intended to focus on Kentucky's prescription opioid crisis. Cameron defeated Stumbo, 57.7% to 42.3%.
On January 6, 2009, he was endorsed by Democratic lawmakers to be the party's nominee for Speaker of the House. He was sworn in as Speaker the next day, January 7. Stumbo advocates creating new usable land for recreational opportunities from strip mining techniques, as well as other forms of post-mining economic reclamation. As an indication of his commitment to Kentucky's coal industry, Stumbo built his home in Prestonburg on a clearing where a mountaintop used to be, near the manicured 18-hole Stone Crest Golf Course. On November 8, 2016, Stumbo was defeated by Republican challenger Larry L. Brown In reaction to this, the Republican Kentucky governorMatt Bevin, who had strongly opposed Stumbo and vice versa, remarked "'good riddance'...he will not be missed one bit. Kentucky will be better for his absence."