WASHINGTON, April 9 (Reuters) - Ragtag teams of modern-day Blackbeards are posing an annoying distraction for Barack Obama, forcing him to add Somalia to an already long list of foreign policy challenges.

American presidents are told to expect the unexpected, and Obama is seeing that this week. First it was a North Korean test of a ballistic missile last weekend. Now comes a swashbuckling high-seas standoff with armed renegades.

Obama so far has sent U.S. Navy ships to protect an American-flagged freighter that managed to repel a pirate attack but whose captain was taken hostage.

America's recent experience with Somalia has not been good, making caution a key element of U.S. policy in dealing with the country.

The Obama administration was careful not to give the crisis too much prominence, with delicate negotiations under way to try to secure the captain's release.

"We're obviously paying careful attention to this issue. And I'm really not able to go beyond that at this point," said State Department spokesman Robert Wood.

Obama, just back from a week-long trip to Europe and a morale-boosting visit to U.S. troops in Iraq, already has a long list of foreign challenges from North Korea to Iran to Afghanistan, and beyond.

He declined to comment on the pirate situation for the second day in a row on Thursday.

And the usually voluble Vice President Joe Biden said only: "This is being worked on around the clock since this happened. I'm not in a position right now (to comment)."

Somalia came to U.S. attention in 1992 when warring factions created a humanitarian crisis.

DISTRACTION

President George H.W. Bush, describing it as "God's work," sent U.S. combat troops to the east African nation in late 1992 to lead an international U.N. force to secure the environment for relief operations.

"We will not stay one day longer than is absolutely necessary," Bush said.

President Bill Clinton inherited the problem. He pulled most of the U.S. troops out in early 1993.

But those that remained were sent to track down warlord Mohamed Farah Aideed, ultimately leading to a 17-hour firefight in Mogadishu in which 18 American soldiers were killed, a disastrous battle that led to the book and movie, "Blackhawk Down."

The pirate episode was a reminder to the United States that Somalia is a festering failed state -- or as Foreign Policy magazine called it, "The Most Dangerous Place in the World" -- and poses a foreign policy dilemma that will not go away.

"We don't want to go back there," said presidential historian Thomas Alan Schwartz, a professor at Vanderbilt University. "This may be one of those points where Obama is going to have to cash in some of his international chips and get the U.N. to go in there."

"Somebody needs to go into Somalia and govern the place," he said.

Democratic strategist Doug Schoen, who worked in the Clinton White House, called the crisis "a real test of national resolve" that the Obama White House and opposition Republicans need to work together to deal with.

"It's an annoyance and a distraction," he said. "On the other hand, if we don't take this seriously and we don't stamp it out we will face what other countries are facing, which are repeated acts of piracy." (Editing by Jackie Frank)