COLUMBIA, S.C. — The Rev. Phillip Miles thought he had the perfect gift when he decided to buy some hunting rifle ammunition for a fellow pastor he would visit. He had already picked out lotion and jewelry for the man's wife and was proud of thinking of something for the man. The problem was, his friend lives in Russia.

For his gift choice, Miles found himself sentenced to years in a detention center half a world away. But with the help of U.S. Embassy officials in Moscow and his church back home, he's now back this week in South Carolina — more than five months after his odyssey began.

"It's been a sore test, no doubt," Miles said Friday, sipping on a diet soda hours before he joined his congregation for a homecoming party at Christ Community Church in Conway.

The 57-year-old American pastor said he was making his 12th missions trip to Russia in January when he ran afoul of the law.

"It's customary to bring the pastor and his wife a gift, and I just had not thought of anything," Miles explained by phone from his Conway home. "Then I remembered that he had just bought himself a new hunting rifle, and I thought, 'Well, I'll just get him some ammunition,' not really thinking that Russia probably wouldn't be happy about something like that."

The box of .300-caliber cartridges was discovered Jan. 29 in his luggage as he switched planes in Moscow for Perm, a city about 750 miles to the east. He was questioned and the ammunition confiscated, but officials let him continue his trip, telling him to report to police on his return to Moscow. On his way back Feb. 3, he was arrested.

Miles was convicted in April. He apologized repeatedly, saying the ammunition was for the Russian friend, a pastor who had recently bought a new Winchester hunting rifle. He said he did not know bringing ammunition into the country was illegal.

Miles said he was judged under the same law that covers arms smugglers and comes with a maximum of seven years of imprisonment.