The accused, identified as Najok Mir, son of Wali Mohammad, from Badakhshan Province in Afghanistan, has also been booked for travelling without a ticket and misbehaving with a government servant, they said.
An Apple laptop, two mobile phones without sim cards, two pen drives, a dongle and two diaries have also been recovered from his possession, police said.
He was arrested by Railway Protection Force yesterday for travelling without a ticket and misbehaving with the ticket checker after he got off from a train coming from Jammu at Pathankot Cantt railway station here, police said.
During preliminary investigation, it came to light that the accused had been staying in India without a proper visa and passport, they said.
Initially, the accused gave investigators a wrong name. "He told us that he has lost his visa and passport but he had not lodged any complaint in this regard," a police official said. The Afghan national had come to India on a tourist visa in 2013.
He had stayed in Bijnor in Uttar Pradesh in a mosque and had acted being a deaf and dumb as he did not know the local language, police said.
Then he moved to Bangalore and thereafter, went to Jammu and Kashmir, police said, adding he had also stayed in Delhi where he worked as a labourer.
"The accused understands Hindi and can converse in this language as well," the police official said. He was presented before a local court which sent him in police remand till February 4, the official said.