Twitter has acquired TweetDeck, Techcrunch heard from a source with knowledge of the deal, and the transaction will be announced in the next few days. The $40 million – $50 million purchase price includes both cash and Twitter stock, says our source.

In February it was reported that UberMedia has acquired TweetDeck as part of its efforts to roll up various Twitter apps under a single company. All Things Digital’s Peter Kafka also wrote that the deal was “pretty far along, with signed term sheets, etc.” However, there was no official announcement, and last month new stories emerged saying Twitter, not UberMedia, was the acquirer.

UberMedia reportedly had a 30-day exclusive on the deal, but negotiations took too long, giving Twitter an opportunity to make a higher offer.

This deal is defensive for Twitter, say all the sources Techcrunch spoke with over the last couple of months. They simply couldn’t allow UberMedia to have so much market share in this space. The company has acquired UberTwitter, EchoFon and a number of other Twitter-related startups.