But researchers now say they have a found a way to use electrical fields, not viruses, to deliver both gene-editing tools and new genetic material into the cell. By speeding the process, in theory a treatment could be available to patients with almost any type of cancer.

“What takes months or even a year may now take a couple weeks using this new technology,” said Fred Ramsdell, vice president of research at the Parker Institute for Cancer Immunotherapy in San Francisco. “If you are a cancer patient, weeks versus months could make a huge difference.”

“I think it’s going to be a huge breakthrough,” he added.

The Parker Institute already is working with the authors of the new paper, led by Dr. Alexander Marson, scientific director of biomedicine at the Innovative Genomics Institute — a partnership between University of California, San Francisco and the University of California, Berkeley — to make engineered cells to treat a variety of cancers.

In the new study, Dr. Marson and his colleagues engineered T-cells to recognize human melanoma cells. In mice carrying the human cancer cells, the modified T-cells went right to the cancer, attacking it.

The researchers also corrected — in the lab — the T-cells of three children with a rare mutation that caused autoimmune diseases. The plan now is to return these corrected cells to the children, where they should function normally and suppress the defective immune cells, curing the children.

The technique may also hold great promise for treating H.I.V., Dr. Wherry said.

The H.I.V. virus infects T-cells. If they can be engineered so that the virus cannot enter the T-cells, a person infected with H.I.V. should not progress to AIDS. Those T-cells already infected would die, and the engineered cells would replace them.

Previous research has shown it might be possible to treat H.I.V. in this way. “But now there is a really efficient strategy to do this,” Dr. Wherry said.