Image copyright Getty Images Image caption T-Mobile boss John Legere broke the news of deal on Twitter.

US telecoms giant T-Mobile has agreed to buy its rival Sprint in a $26bn (£18.9bn) deal.

The merger of America's third and fourth largest mobile carriers is designed to create a more competitive firm with about 130 million customers.

However, the deal is expected to attract regulatory scrutiny over its potential impact on customer prices.

T-Mobile boss John Legere said the new firm would spend $40bn on building a 5G mobile network in the next three years.

"Together, we will build the highest-capacity mobile network in US history!! I'm talking 30X more capacity than T-Mobile today!!" he said in one of a series of Tweets.

It comes after months of negotiations between T-Mobile's controlling shareholder, Deutsche Telekom, and Japan's SoftBank, which controls Sprint.

Under the deal, Deutsche Telekom will own 42% of the combined company and control its board. Softbank will hold a 27% stake.

Mr Legere will lead the new firm which will take the T-Mobile name and have a market value of $146bn.

Analysts say the combined company will have more clout to compete with the first and second biggest US telecoms firms, Verizon and AT&T, each of which have more than 100 million subscribers.

In particular, they say it will be better positioned in the race to provide America with next generation 5G mobile broadband technology.

They also believe that, without T-Mobile, Sprint lacks the scale needed to upgrade its network.

Competition concerns

Sprint and T-Mobile had been in talks about a potential tie-up since 2014, when the Obama administration scuppered a previous merger attempt over competition concerns.

Under the Trump administration, regulators have continued to challenge deals they believe could push up prices and are likely to scrutinise this latest takeover closely.

Image copyright Getty Images Image caption Sprint is the fourth largest mobile broadband provider in the US

The US Justice Department is currently trying to block AT&T's deal to buy US media giant Time Warner for $85bn, warning that "consumers all across America will be worse off" if it goes ahead.

It has also allegedly opened a probe into claims of co-ordination by AT&T, Verizon and a telecoms standards body to hinder consumers from easily switching provider, Reuters reported earlier in April.

In a statement, Mr Legere said the merger between Sprint and T-Mobile would lower prices and help the US accelerate its development of 5G, amid fierce competition from China.

He also said it would create tens of thousands of jobs in rural America - factors analysts say could help sway officials in the Trump administration.

"This combination will create a fierce competitor with the network scale to deliver more for consumers and businesses in the form of lower prices, more innovation, and a second-to-none network experience - and do it all so much faster than either company could on its own," Mr Legere said.