European airlines are expected to face strong headwinds going into 2017 as geopolitical risks play out, analysts at Barclays noted on Wednesday.

The sector  has confronted issues including terrorism, deteriorating commodity markets, sluggish European economic growth and uncertainty following the U.K.'s Brexit vote. And while low oil prices have benefited many airlines, margins across the industry have stopped expanding.

 "Unit revenue weakness is close to recessionary levels, and is almost entirely offsetting fuel savings, meaning margin expansion has slowed to a halt. This has not been helped by infrastructure and operational cost pressures this summer, such as French ATC strikes and airport congestion," Barclays analysts wrote. 

However, those airlines with strong cash generation and opportunities for structural margin expansion that can offset industry headwinds could be good bets, they added.

Barlcays said that it suspects "many airlines, which have prospered from low oil but are used to historically lower returns, may well be happy to sacrifice margins to build or defend market share."

They recommend low-cost carrier Ryanair (RYAAY) - Get Report and British Airways owner International Airlines Group (ICAGY) .

Barclays has a target price of €15 ($16.86) for Ryanair and 460 pence ($6.06) for IAG. IAG currently has a share price of 415.70 pence, having lost 30% over the past year.

Ryanair was at €12.93 on Wednesday afternoon in London, down 7% over the past year.

Over the summer, multiple airlines warned that terror threats in Europe would impact the bottom line.

In its first-half results released in August Lufthansa (DLAKY) said it expected 2016 adjusted Ebit to be lower than last year, when it made profit of €1.8 billion.

The carrier said it is aiming to cut costs by between 2% and 3% in the second half of the year.

Lufthansa chairman and CEO Casten Spohr said in a statement that the terrorist attacks have had a "tangible impact on passenger volumes".

He added, "The forward bookings, in particular for our long-haul services to Europe have declined significantly. We expect the high pricing pressure to continue."

Air France-KLM (AFLYY) warned that the attacks would hit revenue and said that long-haul bookings had decreased. The company was concerned about the attractiveness of France as a destination following the attack in Nice in July and last November's mass shootings in Paris.

Last week, the CEO of IAG Willie Walsh and CEO of lost-cost carrier Easyjet Carolyn McCall said that they would expect to see further consolidation in the European airline industry due to increasing competition and lower margins.

McCall said that weaker airlines were suffering in the tougher market conditions, as the boost to margins from lower fuel prices is eroded by price competition.

However, Barclays disagreed, saying that that they think the current level of profitability mean that there is unlikely to see any major capacity cuts or a wave of consolidation.

The analysts do expect the sector to slip back in earnings next year. "However, into 2017, we think stock price performance may start to disconnect, as it becomes clear that some companies have the ability to generate structurally higher margins, and gradually start to rerate as their peers slip backwards," Barclays said.