In 2017, widespread use of remotely controlled androids called "surrogates" allows everyone to live in idealized forms from the safety of their homes. In contrast to their surrogates, the human operators are depicted as slovenly and homebound. A surrogate's operator is protected from harm and feels no pain when the surrogate is damaged. FBI agent Tom Greer (Bruce Willis) has a strained relationship with his wife Maggie (Rosamund Pike), as a result of their son's death several years before. He never sees her outside of her surrogate and she criticizes his desire to interact via their real bodies.
Tom and his partner, Agent Jennifer Peters (Radha Mitchell), investigate the death of two people who were killed when their surrogates were destroyed at a club. Jarid Canter (Shane Dzicek), one of the victims, is the son of Dr. Lionel Canter (James Cromwell), the inventor of surrogates. Tom and Jennifer determine that a human named Miles Strickland (Jack Noseworthy) used a new type of weapon to overload the surrogates' systems and kill their operators. After locating Strickland, Tom attempts to bring him into custody. Strickland uses the weapon and injures Tom during the chase; Tom inadvertently crash-lands into an anti-surrogate zone known as the Dread Reservation (one of many throughout the United States). A mob of humans eventually destroys Tom's surrogate, forcing him to interact in the world without one. The Dread leader known as The Prophet (Ving Rhames) kills Strickland and confiscates the weapon.
Tom learns from Colonel Brendan (Michael Cudlitz) that the same company manufacturing the surrogates originally produced the weapon under a government contract. It was designed to load a virus that overloads the surrogate's systems, thus disabling it. Unexpectedly, the weapon also disabled the fail-safe protocols protecting surrogate operators. After the first test, the project was scrapped and all but one prototype were destroyed.
Jennifer is murdered and an unknown party hijacks her surrogate. Tom is informed that Andrew Stone (Boris Kodjoe), his FBI superior, supplied the weapon to Strickland and ordered Dr. Canter's assassination for his criticism of surrogate use. Jarid, using one of his father's many surrogates, was killed instead. The Prophet orders the weapon be delivered to Jennifer. During a military raid on the reservation led by Col. Brendan, the Prophet is shot, revealing his identity as a surrogate, with none other than Dr. Canter himself as the operator.
Tom goes to Dr. Canter's home and discovers that he has been controlling not only the Prophet, but Jennifer as well. Using Jennifer's surrogate in FBI Headquarters, Dr. Canter uses the weapon to kill Stone and proceeds to upload the virus to all surrogates, which will destroy the surrogates and kill their operators. Believing his plan to be unstoppable, Canter disconnects from Jennifer's surrogate and swallows a cyanide pill. Tom takes control of Jennifer's surrogate and, with the assistance of the network's system administrator, Bobby Saunders (Devin Ratray), insulates the virus so the operators will survive. Tom can choose to either destroy all surrogates or simply cancel the virus upload. Tom ultimately decides to let the virus permanently shut down surrogates worldwide. People emerge from their homes without their surrogates, confused and afraid.
Tom returns home and shares an emotional embrace with Maggie in her real form. The film ends with an aerial view of the collapsed surrogates along with overlapping news reports of downed surrogates all over the world and how people are now "on their own" again.

Question: Who allowed the weapon to be developed under a contract?
Answer: The government
Alternative answer: the government