Media playback is unsupported on your device Media caption Andrew Milroy from industry analysts Frost and Sullivan explains what Samsung is doing right

Samsung Electronics has said that it expects its profits to surge 79% in the second quarter as sales of its smartphones continue to grow.

It has forecast an operating profit of 6.7tn won ($5.9bn; £3.8bn) for the period, its highest quarterly profit since 2008.

Its fortunes contrast with its Taiwanese rival HTC, which has reported a 58% fall in three-month profits.

Disappointing European sales and problems with US customs were blamed.

Samsung overtook Nokia as the world's biggest maker of mobile phones earlier this year.

Analysts said its profits could rise even further in the coming months.

"Earnings will be stronger in the current quarter, as sales of the high-end Galaxy S III will increase dramatically and drive the telecom division's earnings to above 5tn won," said Nho Geun-Chang, an analyst with HMC Investment Securities.

"We estimate shipments of the Galaxy S III will reach 19 million units in the third quarter."

Growing competition

Samsung launched the Galaxy S III, the latest version of its Galaxy range of smartphones, in May this year, and the gadget has been well received in the market.

What they are worried about are the legal spill over effects Jasper Kim, Asia Pacific Global Research Group

Last month, the head of Samsung's mobile phone division Shin Jong-kyun said that the firm expects to sell 10 million units of the model by July.

While it has enjoyed early success, some analysts were of the view that its sales may slow towards the end of the year due to the widely-expected launch of the latest version of the Apple iPhone.

The iPhone is seen by most analysts as the biggest rival to Samsung's smartphones.

"We expect a correction in Samsung's earnings in the fourth quarter, as the launch of the new iPhone will lead to a decline in Samsung's profit in the high-end smartphone business," said Park Jong-Min a fund manager with ING Investment Management.

'Legal spill over'

Increased competition from the iPhone is not the only challenge Samsung has to deal with in the coming months.

It is also involved in a number of legal disputes over patent infringements with Apple in various countries across the world.

Earlier this month, a court banned sales of Samsung's Galaxy Nexus smartphone and also its Galaxy Tab 10.1 tablet PC in the US, until it decides on the continuing patent case between the two firms.

Image caption Some of Samsung's gadgets have been banned for sale in the US over continuing patent disputes

There are concerns that the ban may hurt Samsung's sales in one of its key markets.

Analysts said the biggest fear for Samsung is that the dispute may become bigger and impact other Samsung products, including the Galaxy S III.

"What they are worried about are the legal spill over effects," Jasper Kim of Asia Pacific Global Research Group told the BBC.

"How Judge Lucy Koh's decision to block some of these Samsung smartphones into the US market, which is Samsung's largest mobile carrier market, will effect Galaxy S III sales. That's what Samsung is really worried about."

Customs problems

HTC reported net profits of 7.4bn Taiwan dollars ($247m; £159m) in the three months from April to June, down from 17.5bn Taiwan dollars in the same period last year.

HTC is relying on its new One smartphones to help it regain market share from Samsung and Apple.

The company blamed the weak economic situation in Europe for its poor sales there.

It also said that its shipments to the US had been held up because they had to be inspected by customs officials as part of a patent dispute with Apple.

HTC announced that its sales in June had been 30bn Taiwan dollars, unchanged from May, but down 33% from June 2011.