Media playback is unsupported on your device Media caption Water dissolving an electronic device - Courtesy Beckman Institute, University of Illinois and Tufts University

Ultra-thin electronics that dissolve inside the body have been devised by scientists in the US and could be used for a range of medical roles.

The devices can "melt away" once their job is done, according to research published in the journal Science.

The technology has already been used to heat a wound to keep it free from infection by bacteria.

The components are made of silicon and magnesium oxide, and placed in a protective layer of silk.

It is part of a field termed "transient electronics" and comes from researchers who have already developed "electronic tattoos" - sensors that bend and stretch with the skin.

They described their vanishing devices as the "polar opposite" of traditional electronics, which are built to be stable and to last.

Getting the electronics to fade away in a controlled manner relies on two scientific developments - getting the electronics to dissolve at all and using a shell to control when that happens.

Image caption The device dissolves when it comes into contact with water

Silicon dissolves in water anyway. The problem is that the size of components in conventional electronics means it would take an eternity. The researchers used incredibly thin sheets of silicon, called a nanomembrane, which can dissolve in days or weeks.

The speed of melting is controlled by silk. The material is collected from silkworms, dissolved and then allowed to reform. Altering the way the dissolved silk crystallises changes its final properties - and how long the device will last.

Prof Fiorenzo Omenetto, from Tufts school of engineering, said: "Transient electronics offer robust performance comparable to current devices but they will fully resorb into their environment at a prescribed time, ranging from minutes to years."

The future?

A range of uses have already been tested in the laboratory including a 64-pixel digital camera, temperature sensors and solar cells.

John Rogers, a mechanical science and engineering professor at the University of Illinois, said: "It's a new concept, so there are lots of opportunities, many of which we probably have not even identified yet."

He told the BBC one likely use would be in wounds after surgery.

"Infection is a leading cause of readmission, a device could be put in to the body at the site of surgery just before it is closed up," he said.

"But you would only need it for the most critical period around two weeks after surgery."

The team of researchers have tested on rats a device that heats a wound to kill off bugs.

There are also ideas around using the technology to slowly release drugs inside the body or to build sensors for the brain and heart.

It could also be used to make other items such as computers or mobile phones more environmentally friendly.

"Imagine the environmental benefits if cell phones, for example, could just dissolve instead of languishing in landfills for years," said Prof Omenetto.