LANSING, Mich. — Democrat Pat Miles, the first black U.S. attorney for western Michigan, launched his candidacy for state attorney general Thursday, emphasizing that he is the only candidate who has led a prosecutor’s office.

Miles, whom President Barack Obama — a Harvard Law School classmate — appointed a federal prosecutor in 2012, left when President Donald Trump took office in January. He is the third candidate to enter the race for the open seat, joining Democrat Dana Nessel and Republican state Sen. Tonya Schuitmaker.

“I have done this job,” Miles said while standing with supporters outside Attorney General Bill Schuette’s office in Lansing. “I fought against violent crime, against opioid abuse. I fought to protect the public and to ensure justice for all. And I worked with law enforcement to build trust and relationships with the communities that they are sworn to protect and serve.”

Democrats and Republicans will choose their attorney general nominees at conventions next summer, and the winners will battle in the general election. Nessel, a criminal defense lawyer who helped win a legal fight to strike down Michigan’s gay marriage ban, previously was an assistant prosecutor in Wayne County.

“No one who’s running for attorney general has the experience that I have as being the U.S. attorney,” Miles told reporters. “No one has led a prosecutor’s office. So what other candidates are going to talk about and promise that they’ll do, I have done.”

The 49-year-old Miles, an Aquinas College graduate, grew up in and lives in Grand Rapids and played pickup basketball with Obama at Harvard. He worked in private practice at large law firms in Grand Rapids before leading the Western District, which covers 49 counties in the Lower and Upper peninsulas.

Miles criticized the record of the term-limited Schuette, a Republican who is running for governor. He said Schuette has pursued ideological causes, has “done too little too late” to combat the opioid epidemic and has let the consumer protection division be “decimated” under his watch. A Schuette spokeswoman countered that he is “focused on his job” — protecting residents from crime and standing up for bullied schoolchildren.

Miles pledged to shut down Enbridge Inc.’s Line 5 oil pipeline, which critics fear is at risk of leaking into the waterway connecting Lakes Huron and Michigan. He added that Michigan needs an “independent voice” to fight Trump policies in court.

This is not the first foray into politics for Miles, who also announced his candidacy in his hometown and planned a late-afternoon stop in Detroit. He won the Democratic primary for an open congressional district in 2010 only to lose to Republican Justin Amash.

Electing Miles or Nessel would be a milestone. He would be Michigan’s first black attorney general. She would be the first lesbian to lead the department.

Follow David Eggert on Twitter at . His work can be found at .