Around 50,000 pupils every year will be taught vital lifesaving skills in the classroom thanks to a national campaign.

Under the initiative all pupils will be taught basic resuscitation techniques before they leave secondary school.

The Nation of Lifesavers campaign, launched last year by British Heart Foundation Scotland, has now been backed by the country's 32 councils.

David McColgan, the organisation's senior policy manager, said: “We are absolutely overwhelmed by the response we have received to our campaign and delighted to have achieved our ambition in such a short space of time.

"To do so is testament to the support we have received from Scotland’s local authorities, wanting to work together to make a difference in their communities.

"Far too many lives are lost in this country when people suffer a cardiac arrest out of hospital, partly because too few bystanders have the expertise or confidence to perform resuscitation. Training pupils is key in helping to change this.”

Medical professionals said the campaign could have a significant impact on the nation’s poor survival rate from out-of-hospital cardiac arrests, where currently only one in twelve people survive.

Dr Andy Lockey, vice-president of Resuscitation Council UK, said: “The achievements in securing such widespread support from councils to deliver CPR training as part of the school curricula are nothing short of amazing.

"We believe the widespread buy-in will reap huge dividends in terms of survival rates in the years to come."

The news came as a father told how his life was saved by his son’s football referee after his heart stopped beating for 25 minutes on the pitch sidelines.

Allan Easdale was watching Kyle, then 14, in a youth tournament on Easter Monday when he suffered a cardiac arrest and fell to the ground next to wife Hazel.

Luckily, the man refereeing was Ewan Hamilton, a 21-year-old Glasgow medical student who had learned CPR only a week earlier.

Mr Hamilton performed chest compressions for 25 minutes before the ambulance arrived. Mr Easdale was then shocked five times with a defibrillator before he opened his eyes and said: “Where am I?”

Mr Easdale said: “It’s a proper save a life story. I shudder to think what would have happened if he hadn’t been there. It took courage to do what Ewan did.”

Mr Hamilton, who now works as a consultant in emergency medicine at Glasgow’s Queen Elizabeth University Hospital, said the incident meant more to him than all his medical achievements.