BlackBerry said it will be booted from Pakistan after refusing to comply with the government's demands to access customers' private messages.

Pakistan has set a December 30 deadline and cited "security concerns," the company said in a blog post Monday.

Pakistan had asked BlackBerry in July to give the government access to all encrypted traffic that flows through the company's servers. BlackBerry refused to comply with Pakistan's order.

"While we regret leaving this important market and our valued customers there, remaining in Pakistan would have meant forfeiting our commitment to protect our users' privacy," said Marty Beard, BlackBerry's chief operating officer, in the blog post. "That is a compromise we are not willing to make."

Beard noted that BlackBerry does provide law enforcement with access to secured messages when it's a matter of public safety. But he said Pakistan was looking for a permanent "back door" into BlackBerry's servers, demanding access to all customers' information.

BlackBerry (BBRY) claims it has never allowed that kind of access to any country in its history.

The company endured a years-long battle with the Indian government over a similar issue in 2011. BlackBerry initially refused to provide any customer data to India, ultimately relenting in 2013 to hand over access to consumers' BlackBerry Messenger (BBM) messages and emails. But the company never complied with the order to hand over its super-secure BlackBerry Enterprise Service (BES) emails and messages, which are used by corporate customers, governments and military personnel.

BlackBerry said Pakistan was only after its BES data -- not consumers' private messages.

The Pakistani shutdown means BlackBerry will not operate servers in Pakistan or provide service for Pakistani residents. BlackBerry customers living and operating outside of Pakistan will still be able to access their messages while visiting the country, because their data is stored in servers elsewhere.

The Pakistani government had initially set the shutdown deadline for Monday but pushed that date back a month.