The merger of Orange and T-Mobile faces a major regulatory hurdle after a last-minute deal thrashed out by the government with all five wireless networks designed to realise Gordon Brown's vision of broadband for all by 2012.

The deal, to be announced this week, is likely to involve the Office of Fair Trading calling on EU regulators to allow the UK authorities to investigate the proposed merger, which has prompted howls of protest from consumer groups as it would create the UK's largest mobile phone operator. The combined group would have a 37% share of the market.

Orange and T-Mobile could be forced to sell some of their mobile phone spectrum in Britain. At the least, an OFT request for UK regulatory scrutiny of the deal – leading to an investigation by the Competition Commission – would delay the merger.

After months of wrangling between industry and the government's wireless spectrum adviser, Kip Meek, which culminated in Lord Mandelson calling the UK bosses of all five operators to a summit meeting last month, a deal has been struck which would impose caps on the amount of spectrum each operator can own.

Neither Vodafone nor O2 will be forced to give up any of their assets, but the deal says a "regulatory remedy" is needed to prevent the combined Orange and T-Mobile owning too big a share of the UK airwaves. In effect it calls on the OFT and Competition Commission to decide at what level to place a cap on the merged company's spectrum.

The wrangling was prompted by the government's Digital Britain plan. In January, then communications minister Lord Carter pledged to bring broadband services within reach of everyone in Britain by 2012. That needed the cooperation of the mobile phone networks to plug the gaps in existing fixed-line infrastructure with wireless broadband. Months of negotiations failed to reach a conclusion by the time of Lord Carter's final report in June. He has since stood down, to be replaced by treasury minister, Stephen Timms.

The problem is that the existing mobile broadband spectrum – bought by the five networks in the dotcom boom for £22.5bn – is only suitable for 3G broadband services in towns and cities. It is no good for running services over long distances, so 3G broadband in more rural areas is uneconomic. The spectrum that is perfect for rural 3G services, however, is owned by O2 and Vodafone which have had it since mobile services began in the mid-1980s.

Allowing O2 and Vodafone to run 3G services over this spectrum would have given both firms an unfair advantage over their rivals, so a wholesale restructuring of the airwaves was required. In addition, the government had plans to auction the spectrum left over from the switch-off of analogue TV – the so-called "digital dividend" – towards the end of next year. That part of the airwaves is just next to the old spectrum owned by O2 and Vodafone and also perfect for running 3G mobile broadband services in rural and remote areas.

No mobile phone company, however, would get involved in the auction until it found out what was going to happen to its existing spectrum.

But the T-Mobile and Orange merger seems to have derailed all thoughts of a complicated spectrum deal with other operators. Under the compromise to be announced this week, all five networks will also see their existing 3G licences extended indefinitely in return for creating high-speed mobile broadband coverage from its current base of just over 80% of the UK population.