If you want to understand both the opportunities and the risks facing Airbnb, all you have to do is spend a few days in Barcelona.

The city is massively popular with Airbnb users and was the company’s sixth-largest city in 2016. But that success has bred confrontation and hard feelings with local elected officials and the tourism industry here. The company needs to find a way to navigate such local fights successfully if it wants to continue growing and justify its sky-high valuation.

Fresh on the heels of the latest dustup with Barcelona, Airbnb policy director Chris Lehane arrived in town to speak at Mobile World Congress, the massive telecommunications trade show. During a broader talk about the factors driving the “sharing economy,” Lehane highlighted the economic impact the company is having on Barcelona.

“We want to democratize travel,” Lehane said. “Our hosts make about 97 percent of all revenues that flow through Airbnb.”

During his presentation, Lehane pointed out that 40,000 of the 100,000 visitors at MWC are staying in an Airbnb, adding that they had come from 120 countries and would generate about 30 million dollars in economic activity this week.

He said the service was addressing the lack of accommodations in Barcelona, but it was also helping to solve a social challenge. He said currently there are about 2.4 million houses across Spain that are vacant. Airbnb in some cases offers a way to use them for tourism. In a country with a stagnant economy, Airbnb hosts make an average of $5,800 per year renting their homes.

Still, not everyone is down with this travel revolution. As a report released this week by eMarketer notes: “The home-sharing service’s future in Spain looks less rosy as local governments up their efforts to control the company’s impact on local housing markets.”

Airbnb, in general, is booming. Its number of visitors doubled in 2016 to 80 million. Europe is a huge part of that, particularly Spain, where Airbnb visits grew 82 percent last year to 5.4 million. About 2.8 million Spanish residents use it when they travel as well, according to eMarketer.

Within Spain, Barcelona leads the way, with 1.24 million visitors last year, followed by Madrid at 642,000. But that success continues to increase friction in Barcelona.

There is the question of taxes, but more fundamentally, there seems to be a fear among Barcelona locals that the balance between residents and tourists is tipping too far in the direction of the latter. And some point the finger at Airbnb for making the number of accommodations too available and too cheap.

As the cost of living rises, residents are finding they can make more money by leaving and renting out their homes.

“We don’t want Barcelona turning into a theme park where neighbors are priced out of their homes and local businesses come under pressure,” Janet Sanz, Barcelona’s deputy mayor for urban planning, told travel news site Skift. “We want to make tourism compatible with the way of life of the people of Barcelona.”

Back in December, Airbnb scored a victory when a Catalonian court threw out a penalty the city of Barcelona had levied against the company for violating its hotel rules. Airbnb expressed optimism that this result would lead to a new discussion about home sharing rules.

In February, Airbnb introduced a new program for Barcelona to limit sharing in some neighborhoods and to collect more information.

“Airbnb is committed to promoting responsible home sharing and working with cities to find solutions to local concerns,” the company announced. “We believe we can work together to achieve clear home sharing rules that work for everyone.”

In the city’s densest neighborhood, Ciutat Vella, the company promised to limit Airbnb hosts to sharing only one entire home listing. It also promised to introduce tools to make it clear who was a professional operator, as opposed to someone personally sharing their home. Finally, the company said it was committed to setting up a system that would allow the city to collect taxes on Airbnb rentals.

The local response? Tourism councillor Agustí Colom was quoted as calling the program “a joke.” He insisted Airbnb immediately take down all listings that lacked a tourist license. Airbnb responded by saying it was “disappointed” by the reaction from city hall, but it noted that other local officials had offered a more positive reaction.

Meanwhile, the Catalan regional government announced it is starting a “public consultation” into the sharing economy to reconsider the rules currently in place. Airbnb asked local users to share their stories with the government as part of that process.

“This is an important moment for home sharing in Catalonia and Barcelona,” the company wrote. “The regional government is drafting a tourism decree that could change the way we understand home sharing today. This is your opportunity to share your story, make your voice heard and help secure clear home sharing rules in Catalonia. With your help, the new rules could make it easier for local families to share their homes.”

The visit to MWC was part of a broader tour Lehane made in Barcelona this week.

He stopped to meet with local entrepreneurs.

And he stopped by to ink a deal with the city’s technology park:

This charm offensive may have a long way to go before it pays dividends. The question now may be how far the city or the national government is willing to go in cracking down on individuals using the platform. Spain has managed to keep ride-sharing giant Uber out.

Uber has managed to continue expanding without Spain for now. That might be tougher for Airbnb to do if it loses two of its most popular destinations.