Toyota Motor Corp will fix the accelerator pedals in 4 million cars and trucks to address a safety issue linked to bursts of sudden acceleration and deadly accidents, the company and the U.S. government said on Wednesday.

The action, which represents the largest-ever U.S. safety recall by the Japanese automaker, aims to address the risk that floor mats in the vehicles can come loose and trap the accelerator pedal on some of Toyota's most popular models including the Camry and hybrid Prius.

Toyota had initially urged owners to remove floor mats in affected vehicles sold over the last six years.

But under the more sweeping and costly recall detailed on Wednesday, Toyota said it would reconfigure and replace accelerator pedals and take other steps after an investigation by the National Highway Traffic Safety Administration.

Toyota said it would install a new brake override system on five models starting next year that will cut power to the engine when the brake pedal is applied even if the accelerator is also engaged.

On Camry and Avalon and Lexus ES350 models, the automaker will also reshape the floor of the vehicle to create more space under the accelerator pedal.

The company was still calculating the cost of the recall, a spokesman in Tokyo said.

But Advanced Research Japan auto analyst Koji Endo estimated it could come to around 40 billion yen ($460 million), while adding he expected little impact on Toyota's short-term earnings.

The company sets aside provisions of about 400 to 500 billion yen for recalls and other after-sales service costs every year, Endo said.

But the massive recall represents a threat to Toyota's image for safety at a time when the automaker is struggling to return to profitability after being hit by an industry-wide sales slump and missteps tied to its own rapid expansion.

Earlier this month, the NHTSA rebuked Toyota for issuing inaccurate and misleading information after the automaker said no defect exists in cases where the floor mat was properly installed.

In fact, NHTSA said, it had concluded that the Toyota models covered by the recall had a very serious defect and simply replacing or removing the floor mats would not be enough.

Toyota's reputation remains strong and consumers remain loyal, but data from independent studies increasingly show Toyota's quality is slipping, said IHS Global Insight analyst Aaron Bragman.

Toyota had the aim of becoming General Motors for many years, and now it has many of the same problems that GM had, like overcapacity and quality issues, he said.

Shares in Toyota held their own despite the news, falling 0.9 percent to 3,390 yen in morning trade in Tokyo, performing better than Honda Motor Co (7267.T) and most other auto stocks. The benchmark Nikkei average .N225 was down 0.1 percent.

CALIFORNIA CRASH

The most immediate catalyst for the Toyota safety action was a crash that killed four people outside San Diego in August. In that incident, an off-duty California state trooper and three members of his family were killed in a crash when the Lexus ES350 he was driving accelerated out of control.

NHTSA said it had received reports of 100 incidents, including 17 crashes and five fatalities, possibly linked to floor mats and accelerator pedals.

Other estimates of the number of incidents of sudden acceleration in Toyota vehicles run higher.

ABC News said earlier this month that it had found reports of 16 deaths and more than 200 accidents linked to sudden acceleration.

The Los Angeles Times reported this month it had found more than 1,000 instances of sudden acceleration reported by Toyota owners. The newspaper said its review of safety records concluded that unintended acceleration may have contributed to 19 fatalities in Lexus and Toyota vehicles.

Toyota said that starting in January drivers who bring their vehicles to Toyota dealerships will have their accelerator pedals cut from the bottom to create more space between the pedal and the floor mat.

From April, Toyota will have redesigned and shortened replacement accelerator pedals available at dealerships, said Toyota spokesman Irv Miller.

The company will also replace the floor mats in vehicles covered by the recall.

The recall covers Camry and Avalon sedans, the Prius and the Tacoma and Tundra pickup trucks. Three Lexus models -- the ES350, IS250 and IS350 -- are also included.

Toyota's investigators have ruled out problems with the electronic controls in the affected vehicles as a cause in the episodes of sudden acceleration, Miller said.

The recall is the second in two days for Toyota. On Tuesday, the company said it would recall about 110,000 older model Tundra pickup trucks due to corrosion problems.

Owners with questions on the recall can find more information at its websites www.toyota.com and www.lexus.com, Toyota said.