By Timothy Gardner and Valerie Volcovici

WASHINGTON (Reuters) - Obama administration officials are concerned about the legality of a ban on oil exports and have begun discussing how to deal with potential challenges from nations that want to buy U.S. crude, two sources said.

Officials in the Office of the U.S. Trade Representative and the National Security Council have each held internal talks about potential free-trade challenges from South Korea and NATO allies, two sources familiar with the matter said.

The internal discussions, which are still at a preliminary stage, are the clearest sign yet that the Obama administration is weighing options for easing the contentious export ban, a move that could dramatically alter global oil trading flows and boost revenues for U.S. producers currently limited to selling their crude domestically.

EU's top trade official, Mexico's state-owned oil company and South Korea's president have all pressed Washington to relax the ban, enacted by Congress after the 1970s Arab oil embargo. There does not appear to be an imminent challenge to the ban, however, experts and officials said.

Washington long ago justified the ban on national security concerns and the need to protect against a domestic oil shortage.

"Not a single one of those exceptions is likely to be able to be successfully defended if somebody challenged it," said Alan Dunn, a lawyer at Stewart and Stewart who represented Washington at the talks that created the World Trade Organization (WTO).

"That puts the White House in a position where it has to figure out what it's going to do."

Oil exports also could offer a foreign policy opportunity, allowing the United States to aid NATO allies, for example, as a geopolitical check against energy-rich Russia, one of the sources said.

A USTR spokesman said no formal talks had taken place on the issue. An NSC spokesman referred questions to the Commerce Department, which administers the export ban. The Commerce Department declined comment.

Story continues

Sources declined to elaborate about the early-stage talks.

The Obama administration could eventually relax the ban, whether through free trade talks or by directly approving oil swaps, in which U.S. light crude exports would be exchanged for imports of heavy crude oil, the preferred crude for U.S. refiners.

A QUESTION OF FAIRNESS

For decades the oil ban was not an issue because the United States imported most of its crude. But thanks to the U.S. shale boom, oil output is growing by 1 million barrels a year, and a glut is threatening to lower prices for domestic crude as soon as this fall.

The United States allows oil exports to Canada as long as the crude is consumed or refined there. And Pemex, Mexico's state oil company, expects to soon import U.S. crude via a swap or a direct import agreement.

U.S. oil producers have so far failed to convince Congress to fully overturn the ban, amid fears it could drive up gasoline prices and encourage more fracking, which environmentalists say would have dangerous consequences.

But with Asia thirsty for oil to satisfy fuel and petrochemical demand, and Europe anxious to diversify supplies away from Russia, other countries are urging the United States to practice what it has preached for decades: free trade.

The fairness issue particularly came into focus after the United States earlier this year won two WTO cases against China, which it accused of hoarding raw materials and rare earth metals.

"Oil-importing countries are watching to see if the U.S. will apply the same standards of open trade in commodities that are not in short supply to its own economy, while it demands these standards from others," the Brookings Institution said in a report released last week on implications of lifting the ban.

The report said allowing some countries to get U.S. oil while otherwise banning exports could be challenged as inconsistent with the global trade law, Brookings said.

A report by the U.S. Congressional Research Service in August concluded that under international trade rules, U.S. restrictions on fossil fuels could be difficult to reconcile with the 1994 General Agreement on Tariffs and Trade.

OIL DIPLOMACY

While the sources didn't elaborate about where the administration talks are headed, the discussions could include using exports as a way to bolster relations with allies who supported sanctions on Iran over its disputed nuclear program.

Other producers have stepped up, but the sanctions halved the OPEC-member's oil exports.

Neil Brown, a former senior adviser for the U.S. Senate Foreign Relations Committee, said relaxing the ban could help the U.S. relationship with Europe.

To stand by a ban would be hypocritical, said Brown, now a principal of KKR Global Institute.

Pressure to relax the ban is building steadily.

Karel De Gucht, the EU's commissioner for trade, said last week that oil and gas needs to be freed up now if a wider free trade pact, the Transatlantic Trade and Investment Partnership (TTIP), is to be completed.

And South Korea's President Park Geun-hye asked a delegation of Republican U.S. lawmakers last month to push Congress to send the country more of an ultra light form of oil called condensates.

Mona Sutphen, former deputy chief of staff for President Barack Obama and now a partner at Macro Advisory Partners LLP, said at an event at Columbia University’s Center on Global Energy Policy this month that a big disruption in global oil production, such as one resulting from conflict in the Middle East, could spur a huge discussion about exports.

Failing that, change could happen at the later stages of long-standing trade talks with Atlantic and Pacific partners, she said.

"That's really the political path that I see," she said.

(Reporting by Timothy Gardner and Valerie Volcovici; Additional reporting by Roberta Rampton; editing by Ros Krasny, Karey Van Hall and Peter Henderson)