Toyota Motor Corp. (TM - Get Report) and Subaru Corp. will recall more than 400,000 cars worldwide to repair an engine part that could cause stalling while driving.

The recall affects some of Subaru's most popular models, including the Forester sport-utility car, Impreza and the BRZ sports car. Toyota is recalling the Subaru-made 86 and Scion FR-S sports car.

The automakers said springs in the engine valve could fracture and cause the vehicles to stall, risking an accident. The springs keep engine valves closed during the fuel combustion process and failure can severely damage the engine.

Toyota said it was recalling a total of 80,000 cars worldwide. In the U.S., the carmaker is recalling about 25,000 Scion FR-S vehicles manufactured between March 2012 and July 2013.

A Subaru spokesman didn't say how many vehicles were being recalled in the U.S. The company is recalling cars made between January 2012 and September 2013. Roughly 101,000 of the recalled cars were sold in Japan. Subaru is expecting a reduction in operating profit of more than $430,000.