Junior doctors in Scotland will no longer have to work seven night shifts in a row under new government guidelines.
Health boards have been told to phase out the practice by February next year.
It currently allows them to meet the European Working Time Directive by averaging hours over six months.
The Scottish government says long shifts are “not in the spirit of the law”.
Responding to the announcement, Dr David Reid, chair of the BMA’s Scottish Junior Doctors Committee, said: “There is a growing body of evidence to demonstrate the dangers of shift working patterns on individual doctors’ performance and more importantly on patient safety.
“It proves that when politicians and management listen to those at the frontline of NHS services, we can work together to make a dramatic difference to the working lives of doctors and improve patient care.”
There have been calls for an end to the practice since Dr Lauren Connelly, a junior doctor at Inverclyde Royal Hospital, was killed in a road accident in 2011 after working long hours.
Health Secretary Alex Neil also wants to simplify the monitoring process for junior doctors’ working hours.
He said that, while progress has been made, more had to be done to ensure the right work life balance was in place.
Mr Neil said: “Scotland’s NHS must continue to attract world class staff so that it can provide truly world class services for patients.
“We have already increased the number of staff working within NHS Scotland and are now focusing on ensuring that they have the best possible working practices.
“While 99% of rotas in NHS Scotland do not include a junior doctor working more than four nights in a row, we are committed to ensuring full 100% compliance from health boards.
“We expect boards to observe not simply the letter, but also the spirit of the law.”
Read the reaction.