GALVESTON COUNTY, Texas — A man who police said just wanted to buy an iPhone ended up shooting and killing a would-be robber in rural Galveston County.

The 38-year-old man answered an ad on the OfferUp app for a late-model iPhone for approximately $500 in cash, the Galveston County Sheriff Office said.

The man agreed to meet the seller about 5 a.m. Tuesday in the 700 block of Lilley, a rural area northwest of Santa Fe, because one of the men said he had to go to work early, GCSO said.

The 38-year-old man arrived at the spot and met with 17-year old Joshua Wooten.

The man said Wooten handed him an empty iPhone box and told detectives Wooten then tried to rob him.

The man was armed and shot Wooten three times, according to detectives. Wooten was flown to a hospital where he was pronounced dead.

GCSO detectives said the shooting appears to be in self-defense, and the case will go before a grand jury.

The man does have license to carry permit, detectives said.

Detectives are warning anyone buying or selling items online should be aware of their surroundings and be cautious when dealing with strangers