DETROIT, June 18 (Reuters) - Legacy U.S. automakers such as Ford Motor and General Motors should leave the China market to preserve capital amid the costly electric vehicle (EV) transition, a leading auto analyst said on Tuesday.

“I think you have to see the [Detroit Three] exit China as soon as they possibly can,” said John Murphy, Bank of America Securities analyst, at his annual presentation of “Car Wars,” a closely watched industry report.

Murphy's guidance for the Big Three came during a discussion of the harsh cost-cutting measures they would have to take to be competitive with EV manufacturers like Tesla, as well as carmakers abroad.

In response to slower-than-expected EV sales, Ford, GM and Jeep-maker Stellantis have focused on cost cutting in all segments of their business. The Big Three will likely have to take more drastic measures to shave off spending, Murphy warned, especially in the automakers' gas-engine operations, which provide the bulk of profits today.

“Very aggressively manage your core business. And it’s really some tough medicine. There's a lot of really hard work to do here,” Murphy said at the event, which was put on by the Automotive Press Association in a Detroit suburb.

China, the largest automotive market in the world, has proven inhospitable for many foreign automakers, especially in recent years.

It is difficult to overcome the strength of Chinese companies on their home turf, Murphy and other analysts noted. Buyers' loyalty to homegrown brands there is strong, and may become even stronger after the U.S. imposes a more than 100% tariff on Chinese EVs, effective Aug. 1, Murphy said.

Ford and GM’s sales in China have slipped over the last decade. The region used to be GM’s largest market, and the automaker is now fighting to post profits there. Ford, noting fierce competition from rivals such as BYD and Geely, is transforming its China business to become an export hub.

(Reporting by Nora Eckert Editing by Marguerita Choy)