India will go after any company, including Google, after cracking down on BlackBerry in its bid to keep the world's fastest growing mobile phone market safe from militants and cyber spying, a government source said on Friday.

BlackBerry's Canadian maker, however, expressed optimism that the company would resolve India's security worries.

India has given Research In Motion, the maker of the popular BlackBerry smartphone, until August 31 to comply with a request to gain access to encrypted corporate email and messaging services or those services will be shut.

RIM is under pressure from governments around the world to give access to its codes. Other firms have also faced scrutiny since officials intensified their fight against Islamic militants misusing mobile devices.

Wherever there is a concern on grounds of national security the government will want access and every country has a right to lawful interference, a senior interior security official, who declined to be identified, told Reuters.

Pakistani-based militants used mobile and satellite phones in the attacks on Mumbai in 2008, which killed 166 people. The militants were suspected of using Internet telephony, which is widely available.

The authorities have for more than a year been looking at Google's messaging, Skype and other providers of communication in India.

Robert Crow, a vice president at RIM, said he believed an agreement could be clinched with the government.

I am optimistic, Crow said after meeting officials from the home (interior) ministry. It is a step in a long journey.

STRICT IMPORT RULES

India has already forced mobile phone operators, including leading Bharti Airtel, to follow strict import rules when buying telecoms network equipment.

Chinese manufacturers Huawei Technologies and ZTE Corp have been temporarily prevented from shipping network equipment for fears of embedded spyware.

We have concerns regarding these (Google and Skype) services on grounds of national security and all those services which cannot be put to lawful interference, the same source said.

India's demands follow a deal with Saudi Arabia, where a source said RIM agreed to give authorities codes for BlackBerry Messenger users. The United Arab Emirates, Lebanon and Algeria also seek access. India wants access to encrypted data in a readable format, a demand RIM is resisting.

How much brinkmanship this is remains to be seen. Not one country recently threatening to ban BlackBerry corporate email or messaging services has carried through with the threat.

We don't expect a ban actually. There will be some solution before the deadline, said a senior official with a mobile phone operator in India, who did not want to be identified.

Officials say RIM had proposed tracking emails without sharing encryption details, but that was not enough.

The company said in a statement on Thursday that it had tried to be as cooperative as possible with governments.

India, like other countries, has been criticized for seeking blanket restrictions while mobile phone operators say they have to offer consumers privacy and secure communications.

Obviously we support the government in its responsibility to provide security, that's not a question, said Rajan Mathews, Director General of the Cellular Operators' Association of India (COAI) and an industry spokesman.

The only issue is how do we go about implementing the security objectives.

India is also keen to retain its position as one of the world's fastest growing IT nations. Google and Microsoft have major R&D centres in India.

Competitors have eaten into RIM's once-dominant share of the North American smartphone market, pushing the company to look to places like India and Saudi Arabia for growth.

A shutdown would hit one million users in India out of the smartphone's 41 million users. India is one of RIM's fastest growing markets.

Given that they (RIM) have got a million-plus BlackBerry subscribers. They are obviously high-end users, and they are principally data users. But you know there are alternatives. What RIM also needs to realize is people like iPhone and Nokia are alternatives, Mathews said.

RIM, unlike rivals Nokia and Apple, operates its own network through secure servers located in Canada and other countries, such as Britain.

If a shutdown takes effect, BlackBerry users in India would only be able to use the devices for calls and Internet browsing.

(Additional reporting and writing by Paul de Bendern; Editing by Alistair Scrutton and Ron Popeski)