WASHINGTON — After years of complaints by passengers and members of Congress, the Transportation Security Administration said Friday that it would begin removing the controversial full-body scanners that produce revealing images of airline travelers beginning this summer.

The agency said it canceled a contract, originally worth $40 million, with the maker of the scanners, Rapiscan, after the company failed to meet a Congressional deadline for new software that would protect passengers’ privacy. Since going into widespread use nearly three years ago, the scanners have been criticized by passengers for being too invasive and are the subject of lawsuits from privacy groups.

The T.S.A. began deploying the scanners in 2010, after an attempt by Umar Farouk Abdulmutallab, a Nigerian citizen, to blow up a Detroit-bound Northwest Airlines flight by setting off explosives hidden in his underwear. The T.S.A. said that 174 of the machines are currently being used at airport checkpoints around the country. Another 76 are housed at a storage facility in Texas.

Rapiscan will be required to pay for removing the scanners. In a statement, Deepak Chopra, the company’s president, said the decision to cancel the contract and remove the scanners was a “a mutually satisfactory agreement with the T.S.A.” The company said that scanners would be used at other government agencies.