Emergency rooms in South Korea are overcrowded, with major hospitals having to cancel scheduled surgeries, after thousands of trainee doctors joined a protest walkout on Wednesday, media said, as a minister warned of danger to seriously ill patients.

The walkout, prompted by a government plan to admit more students to medical school, could threaten people's lives and safety, authorities said, while threatening an investigation and the possible arrest of those responsible.

"The police and the prosecutors' office will consult and take measures against any group or individuals who are leading collective action, including arrest and investigation," Safety Minister Lee Sang-min told a news conference.

Apart from overcrowded emergency rooms, five major hospitals in Seoul, the capital, were having to cancel between a third and a half of scheduled surgeries, media said.

The health ministry says 7,813 doctors have left their jobs since the protests began this week, defying a government order to stay at work, a step the doctors call unconstitutional.

Vice health minister Park Min-soo urged protesters to prioritise patients over collective action.

"The basic calling of medical professionals is to protect the health and lives of the people, and any group action that threatens that cannot be justified," he told reporters.

To boost healthcare in remote areas and meet growing demand in one of the world's most rapidly ageing societies, the government wants to boost medical school admissions to 5,000 from the 2025 academic year, against 3,000 now, and then add 10,000 more by 2035.

However, the protesters say South Korea has enough doctors, calling instead for better pay and work conditions, particularly for specialists in key areas such as paediatrics and emergency medicine, before recruiting more students.

About 76% of South Koreans back the government's plan to increase the number of medical students, a Gallup Korea poll showed last week, amid concerns over staff shortages outside the greater Seoul area.

South Korea's population of 52 million had 2.6 doctors per 1,000 people in 2022, far below the average of 3.7 for peers in the Organisation for Economic Co-operation and Development (OECD).

One group participating in the protest, the Korea Interns and Residents Association, said the doctors deserved better treatment, including more pay.

It criticised the plan for more medical school students as a political ploy ahead of a general election in April.

"We couldn't just sit back and watch medical policies built only for the sake of winning the general election," it said in a statement. (Reporting by Ju-min Park; Editing by Miral Fahmy and Clarence Fernandez)