A Pinal County deputy prepares to search the desert near Stanfield, which is just off Interstate 8. OSCAR PEREZ / CASA GRANDE DISPATCH

Three suspected illegal immigrants were in custody Saturday as "persons of interest" in the shooting of a Pinal County deputy near Casa Grande, authorities said.

The three were among 17 people, all suspected illegal immigrants, detained by deputies and U.S. Border Patrol agents during a search for those involved in the shooting of Deputy Louie Puroll, 53, said Lt. Tamatha Villar, a Pinal County Sheriff's Department spokeswoman.

The three in custody appeared to match the descriptions given by Puroll, who was shot, apparently by smugglers, in the desert about 25 miles west of Casa Grande Friday afternoon, Villar said.

Authorities searched the area Saturday looking for two other men who were reportedly armed with two AK-47s and possibly a handgun, she said.

One of the men was wearing a green or brown army-fatigue-type long-sleeve shirt with tan pants, a baseball hat, a black handkerchief covering his face and black hiking boots or shoes.

The other man was wearing a gray hooded sweatshirt drawn around his face, green pants and black and white Air Jordan-type sneakers, Villar said.

The Sheriff's Department is not releasing any information on whether any weapons or other evidence had been found, she said. Neither would she specify where the group was found, citing the investigation.

Puroll was shot while doing surveillance in the desert near Arizona 84 and Interstate 8, she said. The deputy came upon bales of marijuana before he was ambushed, she said.

At least one person opened fire on him, and a running gunbattle ensued, with at least 30 shots exchanged, probably many more, Villar said. The deputy used his pistol until it either jammed or ran out of ammunition, then discarded the gun and began firing with his tactical rifle.

At about 4 p.m., Puroll called for help from his cell phone, saying he had been shot in the side, she said. Puroll told authorities he fired back, but he did not know if anyone was hit, she said

On Friday, the Sheriff's Department and other law enforcement agencies launched a massive search in the desert for the deputy and the shooter or shooters.

An Arizona Department of Public Safety ranger helicopter found Puroll more than an hour after he was shot, she said.

Puroll was taken by ambulance to Casa Grande Regional Medical Center, where was treated and released Friday night.

Puroll, a 15-year veteran, is a search-and-rescue deputy who patrols remote areas of Pinal County, encountering everyone from stranded hikers to groups of illegal immigrants, Villar said.

On Saturday, several hundred officers from local, state and federal agencies, assisted by several helicopters, continued scouring a 10-square-mile area of rugged desert. The search was called off as darkness fell.

It wasn't clear whether those already in custody were part of the same group.

The U.S. Border Patrol searched areas outside the perimeter and arrested other suspected illegal immigrants.

The Associated Press contributed to this story. Contact reporter Jamar Younger at jyounger@azstarnet.com or call 573-4115.