Ailing mobile phone maker Nokia warned its phone business would post losses in the first two quarters this year, as it struggles to revamp its product line to compete with rivals Apple and Samsung <005930.KS>.

Earlier on Wednesday, Nokia also said it had found a software bug in the new Lumia 900 smartphone, its big hope to take on Apple's iPhone, and was effectively giving the model away until it is fixed.

Nokia said its phone business, which is launching new products on Microsoft's Windows Phone operating system to reverse the decline of old lines running Symbian software, would make an operating loss of around 3 percent of sales in the first quarter, having earlier forecast around breakeven. It predicted a similar or larger loss in the second quarter, below all 29 analysts' forecasts gathered by Reuters.

On average, analysts had expected a profit margin of 0.4 percent for the first quarter, and 2.1 percent for the second.

It's a disaster, said Thomas Langer at WestLB. Shipments of Symbian devices are declining faster than we anticipated ... (and) the ramp up of Lumia devices is not fast enough to compensate for the shortfall.

Nokia's share price plunged as much as 19 percent to 3.10 euros after news of the coming losses hit the market, their lowest level since the 1990s. The shares had already dropped more than 50 percent since the firm unveiled the swap to Microsoft in February 2011.

Nokia's challenges have been exacerbated by rampant competition - notably Apple and Samsung, who are extracting a disproportionate amount of margin from the industry at present, said Ben Wood at CCS Insight.

Though still the world's biggest volume maker of cellphones, Nokia lost the top spot in the lucrative smartphone market last year to Apple and phones running Google's Android system, in part due to its weak performance in the United States, where its smartphones have slipped to less than a 1 percent market share.

LOST GROUND

WestLB's Langer does not expect the problems to end in the second quarter.

In Q3 we will have the iPhone 5 and (Samsung's) Galaxy S3 and so on, so EPS (Nokia's earnings per share) for 2012 is now somewhere in limbo. I think they need to start the second or maybe the third phase of a restructuring program. It's a very difficult situation for them.

Nokia said it sold over 2 million units of all its Lumia smartphone models in the quarter to end March, up from over 1 million in the overlapping November-to-January period, but analysts said they had expected a faster uptick in sales.

Mikael Rautanen from research firm Inderes said he was expecting twice the sales volume.

This poured a lot of cold water on investors, and I think the stock is reacting accordingly, he said.

The battle to recover lost ground was made a little harder by the data connection bug in the Lumia 900, Nokia's first 4G phone, which it markets with the strapline an amazingly fast way to connect. Nokia said a software update to fix the problem, a memory management issue related to phone software, not to hardware or the Windows operating system, would be available around April 16.

It is offering anyone who has bought a Lumia 900 phone, or who buys one by April 21, a $100 credit to their AT&T bill. The operator sells the phone for $99.99 with a two-year contract.

The Lumia 900 is currently only available in the United States, where it was launched on April 8, and is key to Nokia's comeback there.

It's like they stalled their engine when everybody is looking at them at the start of their race, said Gartner analyst Carolina Milanesi.

It is the third Nokia phone to run the Windows operating system since the company ditched the Symbian system last year. It is due for a wider global launch this quarter. The model won several awards at the Consumer Electronics Show in Las Vegas when it was unveiled in January.

COSTLY GLITCH

I must say I have not encountered anything, but I have been impressed by their forthright, aggressive, and undoubtedly costly response, said Boston-based analyst John Jackson from CCS Insight, who uses the Lumia 900.

Though one analyst who asked not to be named said it would only cost Nokia at most $10 million on likely sales before the fix, it will be a big disappointment to a company struggling to revive its brand. Its share of the global smartphone market tumbled to 12 percent in the fourth quarter of last year from 30 percent a year earlier.

To have a memory issue causing disruption to what was otherwise, apparently, a fairly good launch, with prime time ads and reasonable reviews, is the last thing they needed - particularly in the U.S., said Tim Shepherd, analyst at Canalys, before the loss warnings.

Nokia created the smartphone industry in the late 1990s with its Communicator models and was the undisputed leader until Apple's iPhone entered the ring in 2007 and Google's Android system was released in late 2008. In late 2010 it replaced its chief executive with Stephen Elop, who headed Microsoft's business division, and later switched to the Microsoft Phone system to arrest the decline.

(Additional reporting by Terhi Kinnunen, Eero Vassinen and Veronica Ek; Writing by Will Waterman; Editing by Mark Potter)