The hunt for a cure for type 1 diabetes has recently taken a "tremendous step forward", scientists have said.
The disease is caused by the immune system destroying the cells that control blood sugar levels.
A team at Harvard University used stem cells to produce hundreds of millions of the cells in the laboratory.
Tests on mice showed the cells could treat the disease, which experts described as "potentially a major medical breakthrough".
Beta cells in the pancreas pump out insulin to bring down blood sugar levels.
But the body's own immune system can turn against the beta cells, destroying them and leaving people with a potentially fatal disease because they cannot regulate their blood sugar levels.
It is different to the far more common type 2 diabetes which is largely due to an unhealthy lifestyle.
The team at Harvard was led by Prof Doug Melton who began the search for a cure when his son was diagnosed 23 years ago. He then had a daughter who also developed type 1.
He is attempting to replace the approximately 150 million missing beta cells, using stem cell technology.
He found the perfect cocktail of chemicals to transform embryonic stem cells into functioning beta cells.
Tests on mice with type 1 diabetes, published in the journal Cell, showed that the lab-made cells could produce insulin and control blood sugar levels for several months.
Dr Melton said: "It was gratifying to know that we could do something that we always thought was possible.
"We are now just one pre-clinical step away from the finish line."
However, his children were not quite so impressed: "I think, like all kids, they always assumed that if I said I'd do this, I'd do it."
If the beta cells were injected into a person they would still face an immune assault and ultimately would be destroyed.
More research is needed before this could become a cure.
Sarah Johnson, from the charity JDRF which funded the study, told the BBC: "This isn't a cure, it is a great move along the path. It is a tremendous step forward.
"Replacing the cells that produce insulin as well as turning off the immune response that causes type 1 diabetes is the long-term goal."
Prof Chris Mason, a stem cell scientist at University College London, said: "A scientific breakthrough is to make functional cells that cure a diabetic mouse, but a major medical breakthrough is to be able to manufacture at large enough scale the functional cells to treat all diabetics.
"This research is therefore a scientific and potentially a major medical breakthrough.
"If this scalable technology is proven to work in both the clinic and in the manufacturing facility, the impact on the treatment of diabetes will be a medical game-changer on a par with antibiotics and bacterial infections."
Dr Gillian Morrison, from the University of Edinburgh, agreed that this "represents a real advance in the field".
She said: "The next important challenge will be to find ways to maintain these cells inside the body so they are protected from the immune response and have long-term function."