British Airways owner IAG is to buy Lufthansa's UK unit bmi for 172.5 million pounds in cash, it announced on Thursday, seeing off rival bidder Virgin in the race to grab loss-making bmi's much coveted runway slots at London Heathrow.

The deal, agreed in principle in November, gives IAG another 56 daily take-off and landing slots at Heathrow, Europe's busiest airport, which is operating at full capacity after plans to build a third runway were scrapped.

Buying bmi's mainline business gives IAG a unique opportunity to grow at Heathrow, one of our key hub airports, IAG's chief executive Willie Walsh said in a statement.

Using the slot portfolio more efficiently provides the option to launch new longhaul routes to key trading nations.

Walsh added there would be some job losses as part of an effort to stem losses at bmi, which last year were 153 million pounds before tax.

IAG, which also owns Spanish carrier Iberia, had faced competition to buy bmi from Richard Branson's Virgin Atlantic, which tabled a rival offer earlier this month.

Lufthansa will make an overall loss on the sale, but will benefit from shedding a structurally loss-making subsidiary, analyst Stefan Kick at Silvia Quandt in Frankfurt said.

We expect the deal to be clearly in favour of Lufthansa's shareholders, Kick said.

Lufthansa has the option of selling bmi's 'bmi regional' and 'bmibaby' units before the deal completes, and IAG will pay a lower price if those business are offloaded, IAG said.

IAG's shares were up 2 percent at 148.2 pence at 0932 GMT, outpacing a 1 percent rise in the FTSE 100 index, while shares in Lufthansa were 1.9 percent higher. ($1 = 0.6384 British pounds)

(Additional reporting by Christoph Steitz in Frankfurt; Editing by Greg Mahlich)