Retired four-star Gen. Stanley McChrystal, dismissed in June from his post in Afghanistan, is coming to teach at Yale this school year.

McChrystal, who was relieved of his duty after he and his staff insulted top White House officials in a Rolling Stone magazine article, served in the military for 34 years and was chosen to command U.S. forces in Afghanistan because of his expertise in counterinsurgency strategy. He will teach a graduate-level seminar in leadership to students studying international relations. Jim Levinsohn, director of the new Jackson Institute for Global Affairs, of which McChrystal is now a senior fellow, said some slots in the seminar will be reserved for undergraduate students.

Levinsohn said he hopes the general will teach at Yale in future semesters, as well.

“I think he’ll come at teaching with a wide variety of experiences,” Levinsohn said, adding that he thinks the seminar will approach leadership from a wide variety of perspectives, including but not limited to that of the military.

The Rolling Stone profile that ended McChystal’s military career, titled “The Runaway General,” painted a portrait of an exacting and intelligent man who wrote prize-winning short stories during his time at West Point and accompanied his troops into dangerous situations on the front lines as a general, but also derided the president and vice president, showing a disrespect for civilian authority that ultimately cost him his command.

McChrystal told the Office of Public Affairs he is excited to teach at Yale and to share his experiences in the military with students.

Correction: Aug. 16, 2010

An earlier version of this article misstated Gen. Stanley McChrystal’s military star rank. He is a four-star, not a five-star, general.