BUFFALO, N.Y. — An immigration judge denied asylum Friday for an Afghan military officer who sneaked away from a U.S. training exercise in Massachusetts to avoid returning to Afghanistan, where he said he had been threatened by the Taliban.

The judge ruled that Maj. Jan Arash did not qualify for certain protections because the Taliban is not a government, his lawyer said, nor had he proven that he would be persecuted, rather than legally prosecuted, by the Afghan government.