Image caption Sky launched its broadband service in 2006

British Sky Broadcasting is buying the UK broadband and fixed line businesses of Spain's Telefonica.

It will give Sky half a million customers who use the O2 and BE brands for their home phone or broadband.

It will pay an initial £180m to Telefonica, with up to another £20m being paid once the customers have been switched to Sky.

Sky said the transaction would make it the second biggest UK broadband provider.

Telefonica said the deal would allow it to concentrate on providing better mobile services, including rolling out 4G.

Biggest UK ISPs by subscribers BT retail 6,569,000 Virgin Media 4,465,000 Sky Broadband 4,235,000 TalkTalk 4,053,000 EE 693,000 O2 560,100 Source: ISP Review

Sky has taken on 4.2 million broadband customers since launching the service in 2006.

The deal will allow Sky to leapfrog Virgin Media and close the gap on the number one provider: BT.

If it is cleared by regulators the deal should be completed in April.

"Sky has been the UK's fastest-growing broadband and telephony provider since we entered the market six years ago," said BSkyB chief executive Jeremy Darroch.

"The acquisition of Telefonica UK's consumer broadband and fixed-line telephony business will help us accelerate this growth."