WASHINGTON (AP) — Republican presidential candidate Ted Cruz is testing the limits of siphoning personal data from supporters, even as he campaigns to protect law-abiding citizens from spying by the government.

His "Cruz Crew" mobile app is designed to gather detailed information from its users' phones — tracking their physical movements and mining the names and contact information for friends who might want nothing to do with his campaign.

That information, and more, is then fed into a vast database containing intimate details about nearly every adult in the United States to build psychological profiles that target individual voters with uncanny accuracy.

Cruz's sophisticated analytics operation was heralded as key to his victory in Iowa earlier this month — the first proof, his campaign said, that the system has the potential to power him to the nomination.

The son of mathematicians and data processing programmers, Cruz is keenly and personally interested in the work.

"Analytics gives the campaign a roadmap for everything we do," said Chris Wilson, data and digital director. "He has an acute understanding of our work and continually pushes me on it."

Data-mining to help candidates win elections has been increasing among both Republicans and Democrats. Mobile apps by other presidential campaigns also collect some information about users.

But The Associated Press found the Cruz campaign's app — downloaded to more than 61,000 devices so far — goes furthest to harvest personal data.

The Cruz app prompts supporters to register using their Facebook logins, giving the campaign access to personal information such as their name, age range, gender, location and photograph, plus lists of friends and relatives. Those without a Facebook account must either provide an email address or phone number to use the app.

The Cruz app separately urges users to let it download their phone contacts, giving the campaign a trove of phone numbers and personal email address. The campaign said that by using its app, "You hereby give your express consent to access your contact list," but Wilson said the campaign will not do this to anyone who declines to allow it when the app requests permission.

Cruz's app also transmits to the campaign each user's physical location whenever the app is active, unless a user declines to allow it. Cruz's campaign tells users it can share all the personal information on users it collects with its consultants or other organizations, groups, causes, campaigns or political organizations with similar viewpoints or goals.

It also shares the material with analytics companies. Cruz's campaign combines the information with data from a group called Cambridge Analytica, which has been involved in Cruz's efforts since fall 2014. A Cambridge investor, Robert Mercer, has given more money than anyone else to outside groups supporting Cruz.

Cambridge has a massive 10 terabyte database — enough to fill more than 2,100 DVDs — that contains as many as 5,000 biographical details about the 240 million Americans of voting age.

Cruz, the junior senator from Texas, has been outspoken about protecting American's personal information from the government, including the National Security Agency. "Instead of a government that seizes your emails and your cellphones, imagine a federal government that protected the privacy rights of every American," he said when announcing his campaign.

Cruz campaign officials reject any comparison, saying it's different for the government versus a campaign to collect data.

The scope of Cruz's system is formidable. Cambridge's database of Americans combines government and commercial data sets such as voter rolls and lists of people who liked certain Facebook posts, along with consumer data from grocery chains and other clients that can provide a voter's preferred brand of toothpaste or whether he clips coupons.

Cambridge CEO Alexander Nix said the company categorizes every American into one of five basic personality types derived from academic research and up to 50,000 questionnaires conducted each month.

For example, a Cruz campaign worker about to knock on the door of a house could access information about the household's members through the Cruz Crew app, receiving prepared scripts about what issues each person was likely to care about, modified to appeal to their personality.

Cambridge and the Cruz campaign stressed that anyone providing personal information through the app does so voluntarily. Data uses are outlined in legal disclosures published on the campaign's website.

The chief technologist at the privacy advocacy group Center for Democracy and Technology, Joe Hall, said politicians are unlikely to strengthen privacy protections as their campaigns become more and more reliant on mining personal data to squeeze out votes.

"This is a form of political-voter surveillance," Hall said. "If people understood that this amount of fine-grained, sensitive data was being used by political campaigns, they would likely feel betrayed."

___

Follow Michael Biesecker on Twitter at https://twitter.com/mbieseck and Julie Bykowicz at http://twitter.com/bykowicz