Tim Cook, chief executive officer of Apple, and Eddy Cue, senior vice president of Internet Software and Services at Apple, attend the annual Allen & Company Sun Valley Conference, July 10, 2019 in Sun Valley, Idaho.

Apple may have lost the 5G battle to Qualcomm, but it's now in a position to win the war.

Apple said Thursday it will buy Intel's smartphone modem business, which includes several patents and about 2,000 Intel employees, for $1 billion. It's no secret Apple has been interested in developing its own modems for the iPhone, and buying up all that Intel IP puts it in a position to have one ready by the time its deal with Qualcomm runs out.

Apple had four bad options when it came to its 5G plans after it settled the royalty spat with Qualcomm in April:

Option one: Settle with Qualcomm and get its 5G chips into iPhones by 2020.

Option two: Wait for Intel to catch up with its 5G modems, which were said to be running behind schedule.

Option three: Choose Huawei's 5G modems, which would be a tough sell in today's environment thanks to trade tensions and cybersecurity concerns.

Option four: Make its own 5G chips, which would take several years and put Apple far behind other handset competitors that are already releasing 5G phones this year.

So Apple went with the least of all evils. It settled with Qualcomm and laid the groundwork for a long-term plan to develop its own modems. Meanwhile, Intel was forced to back out of its 5G modem plans once Apple and Qualcomm signed their deal, and its assets were relatively cheap and attractive for Apple to scoop up and get a head start on its own chips.