Viruses cannot replicate on their own; they must hijack other cells and turn them into virus production factories.
A study, published in Nature Immunology, showed how some parts of the immune system destroy their own raw materials, stopping HIV.
It is uncertain whether this could be used in therapy, experts caution.
HIV attacks the immune system and can weaken the body's defences to the point that everyday infections become fatal.
However, not all parts of the immune system become subverted to the virus' cause. Macrophages and dendritic cells, which have important roles in orchestrating the immune response, seem to be more resistant.
Last year researchers identified the protein SAMHD1 as being a critical part of this resistance. Now scientists believe they know how it works.
They have shown that SAMHD1 breaks down the building blocks of DNA. So if a cell needs to make a copy of itself it will have a pool of these building blocks - deoxynucleoside triphosphates or dNTPs - which make the new copies of the DNA. However, they can also be used by viruses.