It could have walked straight out of a scene from Star Wars - but this space-exploring humanoid robot is for real, and being developed in the UK.

Scientists at the University of Edinburgh hope that in around five years their 6ft (1.8m) tall creation, which weighs a shade under 20 stone (125kg), will be ready to go to Mars.

Like the Star Wars character C-3PO, the robot walks on two legs and has jointed arms and hands that can grasp objects.

There the comparisons end, however. The humanoid machine taking shape in Scotland is much bigger and less friendly looking than its film world cousin - a product of engineering necessity rather than deliberate design.

Perhaps fittingly it has been named Valkyrie, after the female war spirits of Norse mythology.

But the robot is not designed for battle, only to act as a servant for human astronauts. US space agency Nasa, which is collaborating on the project with the University of Edinburgh, intends to send Valkyrie to Mars before the first human explorers who are expected to journey to the Red Planet in the mid 2030s.

Professor Sethu Vijayakumar, director of the Edinburgh Centre for Robotics, said: "Valkyrie is a huge scientific undertaking. We are looking forward to tackling the many technical challenges involved in developing a large-scale humanoid robot, and pushing the state of the art in humanoid robotics.

"At the moment the robot is a pretty basic shell which can walk up a set of three small steps and can reach out and grip something and pass it on to someone. It reacts if you push against it, either swaying or taking a step back.

"The big challenge will be getting Valkyrie to interact with people; you have to have some pretty adaptable algorithms. The dream is to have something that can be a co-worker for astronauts on space missions, for example."

Valkyrie is the only example of its kind in Europe and one of three prototypes in the world.

Nasa built the machine's basic hardware before shipping it to the University of Edinburgh, which has a worldwide reputation for designing "smart" robotic systems.

The humanoid design was chosen to make it easier for Valkyrie to work alongside people so that, for instance, no special ramps have to be provided to accommodate wheels.

"We want systems that work in environments built for humans," said Prof Vijayakumar. "Also, small wheels sometimes get stuck and big wheels are not very manoeuvrable. It's not by accident that humans were designed to be bipedal."

Maintaining balance is one of the biggest hurdles to be crossed when designing a walking humanoid robot.

Valkyrie overcomes this problem by rapidly computing in real time how to alter its centre of mass position to stay upright.

Currently the robot is equipped with a pair of stereoscopic camera "eyes", other cameras on its belly, and an intricate set of force sensors to help it react to touch and pressure.

It has no "ears" and, unlike C-3PO, cannot speak. But it has one sensory system not possessed by humans - a spinning laser radar or "Lidar" housed in its face. The instrument measures the distance to objects by firing pulses of light at surfaces and timing how long it takes the reflected "echoes" to bounce back.

The robot has a total of 34 "degrees of freedom" - essentially, modes in which it can move.

Prof Vijayakumar said he expected Valkyrie to acquire more dexterous capabilities over the next three years. Theoretically, it could be ready to work alongside humans in four to five years.

Although Valkyrie has been specifically designed to support Nasa space missions, the Edinburgh team believes the robot's potential is far wider.

"We have a much bigger remit and can see the technology in a lot of other domains, for example health care and disaster scenarios," said Prof Vijayakumar.

Scientists at Heriot-Watt University in Edinburgh are also involved in the project.