Harvard University on Friday withdrew a fellowship invitation to Chelsea Manning, the transgender U.S. Army soldier who was convicted of leaking classified data, after two top intelligence experts distanced themselves from the school over the invite.

Ms. Manning, 29, was released in May from a U.S. military prison in Kansas where she had been serving time for passing secrets to the WikiLeaks website in the biggest breach of classified data in the history of the United States.

Harvard Kennedy School of government announced on Wednesday that it had invited the controversial figure to be a visiting fellow and speak at a forum. The invitation to speak at the university still stands, said Douglas Elmendorf, the dean of Harvard Kennedy School, in a statement.

“I now think that designating Chelsea Manning as a visiting fellow was a mistake, for which I accept responsibility," Mr. Elmendorf said. “I see more clearly now that many people view a visiting fellow title as an honorific, so we should weigh that consideration when offering invitations.”

The announcement came after CIA Director Mike Pompeo canceled a speaking engagement at the university on Thursday over the invitation to Manning, whom he called an “American traitor” in a letter to the university regarding his decision.

“My conscience and duty to the men and women of the Central Intelligence Agency will not permit me to betray their trust by appearing to support Harvard's decision with my appearance,” he wrote.

Also on Thursday, former deputy director and acting director of the CIA Michael Morell resigned as a senior fellow at the university, media reported.

“Good,” Ms. Manning tweeted after Mr. Morell resigned.