KABUL, Afghanistan — The Afghan government lashed out Thursday at criticism of its expulsion of an American journalist, the first such action since the ouster of the Taliban, denouncing him as a spy in an official statement.  Both the American ambassador and the top United Nations representative here sharply criticized the expulsion of the journalist — Matthew Rosenberg, 40, a correspondent for The New York Times — who left Kabul on Thursday evening, within a 24-hour deadline imposed by the Afghan attorney general’s office. The order came after an article written by Mr. Rosenberg, first published on Monday, reported on efforts by some officials to resolve an electoral crisis.  Apparently in response to the public condemnations, the Government Media and Information Center, an agency controlled by the president’s office, issued a statement saying that it “considers Mr. Rosenberg’s report more of an espionage act than a journalistic work, one that was meant to create panic and disruption in people’s minds, and provide the basis for other spying purposes.”  Matthew Rosenberg, an American correspondent for The New York Times, and Basir Azizi, the spokesman for Afghanistan’s attorney general, discussed the journalist’s expulsion from the country.  Dean Baquet, the executive editor of The Times, who has strongly protested the expulsion order, rejected the accusation against Mr. Rosenberg. “I am outraged,” Mr. Baquet said. “He is a reporter who breaks important stories.”  The American ambassador to Afghanistan, James B. Cunningham, met with President Hamid Karzai on Thursday and afterward issued a statement calling the expulsion a threat to the country’s budding democratic system and a “regrettable step backward” for its press freedom. It appeared that the ambassador did not ask Mr. Karzai to reverse the decision to expel Mr. Rosenberg.  But Mr. Cunningham’s statement bluntly reflected American anger with the Karzai government. “I expressed today to President Karzai our strong concern about this unwarranted action,” the ambassador’s statement said. “I asked him to affirm his government’s recognition of the importance of protecting the freedom of the press, as an important part of the legacy of his presidency.”  Earlier, Jan Kubis, the representative of the United Nations secretary general, issued a statement that said the expulsion was “a disturbing disregard for freedom of expression” and called on the Afghan government “to urgently review their actions in light of due process, domestic laws and the international obligations of Afghanistan to safeguard media freedoms in the country.”  The action against Mr. Rosenberg is the first public expulsion of a Western journalist in Afghanistan since the Taliban were felled in the American-led invasion in 2001. It comes as the Afghan government is mired in a crisis over a disputed presidential election and as the United States is preparing to withdraw military forces at the end of this year.  The government apparently was infuriated by Mr. Rosenberg’s article on the electoral crisis, which reported discussions among high-ranking officials about forming an interim governing committee as a possible way to resolve the impasse, a step that would amount to a coup.  The Afghan attorney general’s office said in a statement that the article was “considered divisive and contrary to the national interest, security and stability of Afghanistan.” While Afghan officials did not detail their complaints about the article, or specify what laws, if any, had been violated by its publication, they previously objected to the use of anonymous sources in the article.  The statement by the government media agency, which was formed with financing and training from the American government, was apparently issued in response to the United Nations’ criticism, which it called “far from reality.”  It expressed regret that the United Nations “called such an intelligence act a journalistic act,” referring to Mr. Rosenberg’s article.  Aimal Faizi, the spokesman for Mr. Karzai, said the government “at the highest levels” had viewed the article as a threat to its national security and felt it was motivated by “deep state interests,” a term used by anti-American figures in the government here to refer to what they view as American interference in Afghan affairs.  Mr. Faizi did not, however, personally accuse Mr. Rosenberg of espionage.  Mr. Cunningham called the decision “a regrettable step backward for the freedom of the press in this country.”  “Freedom of the press and the establishment of a vibrant media environment are important achievements for Afghanistan and its citizens in the country’s first dozen years of democracy,” his statement said. “These gains are threatened by the decision yesterday by the government of Afghanistan to expel New York Times reporter Matthew Rosenberg. We deplore this decision, which is unjustified and based on unfounded allegations.”  Mr. Cunningham also said “there is no mistaking the signal this sends to all journalists working in Afghanistan, whether they are Afghan, American, or any other nationality.”  Mr. Rosenberg was on a flight out of the country as Mr. Cunningham’s statement was released.  A few hours earlier, on his Twitter account, Mr. Rosenberg posted the expulsion order, which called him a spy with “secret relations.” He also said the chief prosecutor of Kabul and the border police had escorted him through the Kabul airport immigration check.  Rod Nordland reported from Kabul, and Rick Gladstone from New York.  A version of this article appears in print on August 22, 2014, on page A8 of the New York edition with the headline: Afghanistan Defends Expulsion of a Times Reporter. Order Reprints|Today's Paper|Subscribe
The government lashed out at criticism from the United Nations and the American envoy over the expulsion of Matthew Rosenberg, saying a report by him was an act of espionage.