NEW DELHI — Responding to a chorus of criticism, Indian officials on Tuesday hastily withdrew a draft policy on encryption that would have required users of social media and messaging applications to save plain-text versions of their messages for 90 days so that they could be shared with the police.

The proposal, which many condemned as both draconian and impractical, came as an embarrassment days before Prime Minister Narendra Modi travels to Silicon Valley to try to attract investment and promote India as an emerging market for digital technology.

Mr. Modi is an avid user of social media and has mobilized large networks of online activists during his party’s campaigns.

The government issued a statement Tuesday saying the draft proposing that users save messages for three months had been withdrawn, as officials hurried to distance themselves from the idea. “I wish to make it clear that it is just a draft and not the view of the government,” said Ravi Shankar Prasad, the minister of communications and information technology.