Uber’s No-Holds-Barred Expansion Strategy Fizzles in Germany . “Everyone must respect the rules.”

Uber’s No-Holds-Barred Expansion Strategy Fizzles in Germany . “Everyone must respect the rules.”

Hasan Kurt, the owner of a local licensed taxi business in Frankfurt, refused to work with Uber when it tried to recruit licensed operators to build its service within the letter of the law. CreditBenjamin Kilb for The New York Times

FRANKFURT — Uber is rapidly expanding its ride-hailing operations across the globe. But here in this city of 690,000 — less than the population of San Francisco, Uber’s hometown — the company recently did something unusual: It retreated.

In early November, Uber shut its small office in Frankfurt’s centuries-old city center after just 18 months of operation, mothballing the online platform that had let people in the city hail rides through a smartphone app. The pullback was spurred in part by drivers like Hasan Kurt, the owner of a local licensed taxi business, who had refused to work with the American service.

With more than 20 years of experience as a taxi operator, Mr. Kurt said he disliked how Uber barreled into Frankfurt in early 2014, using primarily unlicensed drivers who had not passed the same exams and health checks required of licensed drivers. That low-cost service, UberPop, which is similar to UberX in the United States, faced legal challenges and was eventually outlawed, last March, by German regulators.

Uber then tried to recruit licensed operators like Mr. Kurt to build its service within the letter of the law. But Mr. Kurt would not budge.

“It’s not part of the German culture to do something like” what Uber did, Mr. Kurt, 45, said over a cup of tea last month during a break in his busy holiday schedule. “We don’t like it, the government doesn’t like it, and our customers don’t like it.”

Uber’s withdrawal from Frankfurt is just one of a multitude of retreats by the company — now valued at $62.5 billion — across Europe in recent months.

In November, Uber also pulled out of Hamburg and Düsseldorf after less than two years of operating in each of those German cities. In Amsterdam, Uber recently stopped offering UberPop.

And in other European cities, Uber faces the prospect of being beaten back — or at least contained. In Paris and Madrid, Uber has been confronted by often violent opposition from existing taxi operators, while in London, local regulators are mulling changes that could significantly hamper Uber’s ambitions there.

Frankfurt offers a case study of what can cause Uber to draw back in one place even as it expands elsewhere.

With a thriving financial center and cosmopolitan population, the city seemed like an ideal place for Uber to operate and grow. Yet the company was forced out by a mix of cultural and legal missteps. Specifically, it miscalculated how best to gain the support of skeptical locals unaccustomed to its win-at-all-costs tactics, and it underestimated the regulatory hurdles of doing business in Europe’s largest economy.

“If you want to be successful in Germany, you have to understand the regulation,” said Martin Fassnacht, a professor at the Otto Beisheim School of Management in Vallendar, Germany. “Uber should have taken that more seriously.”

Uber has not completely withdrawn from Germany. It still operates licensed services in Berlin and Munich, and company executives say there is pent-up demand from passengers frustrated with current taxi services.

The company has argued it can add thousands of new jobs in Germany if it is allowed to operate freely, though a spokesman declined to say how many German drivers are active on its platform.

Uber has also asked the European Commission, the executive arm of the European Union, to intervene, and an official European investigation into Germany’s ban on UberPop — along with similar rulings in France and Spain — is expected to be completed sometime this year.

“Have we made mistakes? Absolutely,” said Mark MacGann, Uber’s head of European policy. “But the current system in Germany artificially protects incumbents who think they have the right to own the market.”

To understand why Uber expanded to Frankfurt in May 2014, you have only to visit the city’s bustling main train station. Throngs of passengers move through the station on their way to Frankfurt’s many banks and its central shopping district.

And as in many German cities, the number of licensed taxis in Frankfurt is capped, at just over 1,700 cars, which means that at peak times, there is often more demand for rides than there are available taxis.

After Uber arrived, unlicensed drivers for UberPop soon began showing up near the main entrance of the train station, enticing potential passengers with discounted rates that were roughly one-third cheaper than those of the city’s licensed operators, according to Frankfurt’s taxi unions.

Such fares quickly set off opposition. Thomas Grätz, head of the Taxi and Rental Car Association, a German trade body, said Uber’s unlicensed drivers had not passed the same lengthy exams and were not subject to similar costs, like the professional drivers’ insurance required by the city’s traditional operators. Uber said its drivers were properly vetted and had appropriate insurance.

Confronted with a growing number of UberPop competitors, Taxi Deutschland, another German trade association, filed a legal challenge against Uber in mid-2014, claiming the company’s drivers did not have licenses to operate nationwide. That led to a long court odyssey of rulings and appeals.

As the legal tension mounted, Uber’s small Frankfurt team tried to drum up interest from locals, many of whom had never booked a taxi through a smartphone app or used a credit card to pay for a taxi. Unlike the United States and other European countries, Germany still has a low level of credit card use, according to industry statistics.

To change those habits, Uber began offering free rides and other incentives to new customers. That helped draw in people like Dan Miner, 32, an American researcher in Frankfurt who signed up for the service after first hearing about it from friends in New York. For Mr. Miner, hailing a taxi through a smartphone app, particularly late at night, was easier than flagging down a licensed taxi that charged for extras like using the trunk.

“More than anything, Uber was cheaper,” Mr. Miner said.

Any momentum was short-lived. In March 2015, a Frankfurt judge ruled that all Uber drivers must hold official permits to operate. Despite the decision, Uber continued to offer its low-cost service — for a while. Then in May, the company shut down UberPop nationwide in favor of only offering licensed services. (Uber had also been offering a luxury chauffeur service in Frankfurt since early 2014.)

That was where the alienation of taxi operators like Mr. Kurt hurt Uber. Since the company had already antagonized local taxi operators by prioritizing its low-cost service, Uber could not persuade enough licensed drivers to sign up, even after it offered to pay for licenses and help with other regulatory costs that totaled as much as $400 for new drivers, according to several local taxi groups and policy makers.

Uber’s aggressive tactics also turned off potential customers like Andreas Müller, a financial analyst who tried the company’s Frankfurt service after first using Uber on a business trip in Chicago. Mr. Müller said he liked the convenience of paying through his smartphone, but soon turned against the company after reading that it had continued operating in violation of court orders and did not directly employ its drivers, who are independent contractors.

“That might work in the U.S., but that’s not how things are done here in Germany,” said Mr. Müller, 37. “Everyone must respect the rules.”

Rhea Wessel contributed reporting.