Children in all forms of state care are to be given the right to continue to be looked after until they are 21, with further support guaranteed until they are 26, the Scottish Government has announced.

The amendment to the Children And Young People Bill was welcomed by young people's groups, councils and social work chiefs after the issue was added to the Bill in which it had not previously featured.

It follows an intensive lobbying effort by charities, children in care and young adults who grew up in the care of councils, which appears to have had a powerful effect on MSPs, ministers and civil servants. Hundreds of vulnerable young people will be affected and the move could put Scotland at the forefront of provision for so-called 'looked after' young people internationally.

A similar development recently announced for England granted support until 21 only for those in foster care. However, the Scottish Government's plans will also cover those who have lived in residential units or with relatives, such as grandparents.

The provisions will affect all teenagers in any form of state care who become 16 from April 2015. Increased funding of £5 million a year until 2020 has been committed by ministers to pay for the plans.

Groups supporting looked after young people were delighted by the announcement and said the measure would help prevent so many young people from a care background ending up homeless, dropping out of education, or ending up in prison or battling addiction.

Minister For Young People Aileen Campbell said the change would help young people prepare better for independent living and said it would give those in care the same chance as children from a non-care background.

The Scottish Government also announced a longer-term goal to give care leavers who need it the chance to return to care, up to the age of 21. An expert group will be set up this year to explore how this might best be done.

The amendment to the Bill had been promoted since last June by the charity Who Cares? Scotland along with partners Barnardo's Scotland and Aberlour.

Duncan Dunlop, chief executive of Who Cares? Scotland, said the effect of leaving care at 16 or even 18 could be far-reaching for young people. "Many lose hope; stop dreaming for better or look to coping solutions that include drugs and alcohol to get through the day", he said.

"We are delighted. I don't know of any other country in the world that has made a commitment like this. Young people from care were at the forefront of that hard work."

Ashley Cameron, 23, grew up in Stirling in a range of care settings, including foster care and a children's home, until she left at the age of 17. "I was homeless for five and a half years and had a series of bad relationships, People stole my belongings and I ended up living with drug addicts and alcoholics," she says.

The change would have benefitted her and she would go back into care now without hesitation, she said. It is unrealistic to expect 16-year-old care-leavers to thrive when the average young person does not leave home until they are 24, she added. "This will put young people in care on a par with other children."

Sara Lurie, director of the Fostering Network Scotland, welcomed the announcement, but said some fostered children would miss out. "We are extremely disappointed the change in the law in Scotland will not help fostered young people who are aged 15 or over on April 1 this year. We don't want to see hundreds of fostered young people in Scotland missing out on what their peers in England will be entitled to as of this April."

Councils also welcomed the plan. Douglas Chapman, spokesman on education, children and young people for the Convention Of Local Authorities, said: "We look forward to working with the Government and our partners in the children's voluntary sector to ensure we continue to deliver for Scotland's most vulnerable children and young people."