A nationwide hunt for the man suspected of killing two hikers on the Appalachian Trail in Virginia ended yesterday with his capture by a dozen police and FBI agents in a wooden area of Myrtle Beach, S.C.

Randall Lee Smith, 27, of Pearisburg, Va., was surprised by police about 9:30 a.m. at a makeshift campsite within the city limits of the popular coastal resort town, 300 miles from the shallow, trailside graves where the bodies of two Maine social workers were found shot and stabbed last month.

Officials said Smith started to run when confronted by police, but then surrendered almost immediately. It was the second time police had searched the area in the last month, they said.

"I'd say he'd been staying there for about 10 days to two weeks," said FBI spokesman Tom Reynolds. "It wasn't really a tip that led us to him, it was more of a hunt and good police work."

Law enforcement officials said Smith, who was charged with two courts of murder on June 11 by Giles County, Va., authorities, became a suspect after eyewitnesses reported that a bearded, dark-haired man fitting Smith's description was seen "acting weird" near the scene of the murders.

The search for Smith focused on Myrtle Beach after his truck was found abandoned there earlier this month. A note found in the truck was described by a Virginia State Police investigator as "an important piece of evidence," but police have not revealed its contents.

The bodies of Laura Ramsay and Robert Mountford, both 27-year-old employes at a center for disturbed youths in Ellsworth, Maine, were found covered with dirt and leaves beside an isolated section of the trail two weeks after friends reported the vacationing pair missing.

Ramsay, who had been hiking for two weeks and was only 13 miles from where she planned to leave the trail, had been stabbed more than a dozen times and her head covered with a plastic garbage bag. Mountford, who had been walking for two months, was shot three times in the head and was found in his sleeping bag.

The slayings, the first on the popular hiking trail is six years, spread fear among hikers along its 2,000-mile length. The brutality of the slayings, said hiking enthusiasts, scared away some of the 3 million hikers who annually traverse part of the trail.

"Nurders happen every day, but we thought the trail was safe from that kind of thing," said Charles Parry, a professor at Virginia Tech who directs maintenance of 70 miles of trail in the Pearisburg area, about 50 miles west of Roanoke.

Smith, a former welder in Giles County where the slayings occurred, was unemployed and living with his mother at the time of the murders, police said.

Smith also was wanted on a federal warrant charging his with interstate flight to avoid prosecution. He currently is being held without bond in the Myrtle Beach city jail pending an extradition hearing