Three people have died and about 40 are missing after an Italian cruise ship with more than 4,000 people on board ran aground and keeled over, sparking scenes of panic.

A rescue operation involving lifeboats, ships and helicopters lasted several hours after the 114,500-tonne Costa Concordia hit a sandbar or a rock near the island of Giglio yesterday evening.

The three who died were two French passengers and a Peruvian crewman.

The captain and the first officer of the ship have been detained by police on suspicion of multiple manslaughter.

Captain Francesco Schettino had earlier told an Italian news channel that the vessel was not off course.

He said: "As we were navigating at cruise speed, we hit a rocky spur.

"According to the nautical chart, there should have been sufficient water underneath us."

Divers have been deployed in the search for survivors from the ship, which is lying on its right (starboard) side.

Coastguard officials said divers have recovered the ship's "black box", which should contain records of the precise route and conversations among the crew.

Fire service spokesman Luca Cari told AFP: "Inspections have just begun. It's complicated because there is a risk that one of the floors would collapse."

Rescue services hope that the ship will not slide deeper into the sea, which is about 100 metres deep.

Irish couple feared the worst

The Department of Foreign Affairs said it is providing assistance to an Irish couple who were on board the ship.

Seamus and Carol Moore from Clonmel, Co Tipperary were on the cruise for a birthday celebration.

Mr Moore spoke to RTÉ about their terrifying experience as the boat began to sink.

He said they spent two-and-a-half hours on the listing deck of the ship before being rescued.

Mr Moore said many passengers had panicked after the collision, especially those with young children.

Many elderly people had great difficulty trying to get to the muster stations because the ship was listing so badly.

Mr Moore said he and his wife got into a lifeboat but it was overcrowded.

As it was being lowered towards the water, it banged into the side of the ship. It then had to be raised back to the deck.

The retired HSE employee said he and his wife thought they were going to die.

They used a mobile phone to call the person minding their youngest child to ensure they knew how to contact their solicitor in the event of their deaths.

"We were trying to plan things for them", said Mr Moore. He said he and his wife decided that, whatever happened, they would try to stick together.

Survivors jumped into freezing waters

The Costa Concordia was on a trip around the Mediterranean when it apparently hit a reef near the Isola del Giglio yesterday as passengers were sitting down for dinner.

Following the incident some of the ship's passengers jumped into the icy waters. Local officials also said at least 14 people were injured.

Around 20 people were rescued by helicopters, which searched the sea with lights during the night-time rescue operation.

Shocked passengers crammed into the island's few hotel rooms and a local church overnight.

Hundreds were transferred by ferry to the Tuscan resort town of Porto Santo Stefano, which is linked to the Italian mainland.

Passengers were initially told the ship had shuddered to a halt for electrical reasons, before being told to put on their life-jackets and head for lifeboats, a passenger from the boat told ANSA by telephone.

The Costa Crociera company, which owns the vessel, said it was "shocked" by the news and expressed its condolences to the families of the victims.

The company said it was not yet possible to say what caused the problem, but that the evacuation had been fast, although made more difficult as the ship took on more and more water and keeled over.

"The ship was on a cruise in the Mediterranean, leaving from Savona with planned stops in Civitavecchia, Palermo, Cagliari, Palma, Barcelona and Marseille," the company said.

"There were around 1,000 Italian passengers on board, as well as 500 Germans and around 160 French people," it added, without giving details about the rest.

The cruise ship - which boasts 58 suites with balconies, five restaurants, 13 bars, five Jacuzzis and four swimming pools - had set off from the Civitavecchia port near Rome earlier yesterday.