After successful intensive interventions to rapidly increase HIV awareness, coverage of antiretroviral therapy (ART), and viral suppression, HIV programmes in eastern and southern Africa are considering scaling back of some interventions, such as widespread general population HIV testing. We aimed to model whether scaling back of general population HIV testing in South Africa could result in a resurgence of the HIV epidemic or substantial slowing of declines in HIV incidence, resulting in increased long-term ART. In this modelling study, we used the Thembisa 4.5 model (a deterministic compartmental model of HIV transmission in South Africa) to project the South African HIV epidemic to 2100 assuming the continuation of 2022 epidemiological conditions and HIV programme implementation. We assessed how implementing reductions in general population HIV testing services in 2025 (while maintaining antenatal, symptom-based, and risk-based testing modalities and other HIV prevention services at 2022 levels) would affect HIV incidence and prevalence among people aged 15-49 years, the year in which incidence would reach one per 1000 people aged 15-49 years (the threshold for virtual elimination of HIV), and associated costs, as well as numbers of additional new HIV infections and AIDS-related deaths. We also modelled the effects of delaying reductions in general population testing services by 5-year increments. Additionally, we modelled the potential effects of reductions in general population testing services in combination with increases or decreases in ART interruption rates (ie, the annual rate at which people who are on ART discontinue ART) and condom usage in 2025-35. If general population HIV testing services and the HIV risk environment of 2022 were maintained, we projected that HIV incidence would steadily decline from 4·95 (95% CI 4·40-5·34) per 1000 population in 2025 to 0·14 (0·05-0·31) per 1000 in 2100, and that the so-called virtual elimination threshold of less than one new infection per 1000 population per year would be reached in 2055 (95% CI 2051-2060). Scaling back of general population HIV testing services by 25%, 50%, or 75% in 2025 delayed time to reaching the virtual elimination threshold by 5, 13, or 35 years, respectively, whereas complete cessation of general population testing would result in the threshold not being attained by 2100. Although the incidence of HIV continued to fall when general HIV testing services were reduced, our modelling suggested that, with reductions of between 25% and 100%, between 396 000 (95% CI 299 000-474 000) and 2·50 million (1·97 million-2·98 million) additional HIV infections and between 115 000 (94 000-135 000) and 795 000 (670 000-926 000) additional AIDS-related deaths would occur between 2025 and 2075, depending on the extent of reduction in testing. Delaying reductions in general population HIV testing services for 5-25 years mitigated some of these effects. HIV testing accounted for only 5% of total programmatic costs at baseline; reducing testing moderately reduced short-term total annual costs, but increased annual costs after 25 years. Increases in ART interruption and reductions in condom usage were projected to slow the decline in incidence and increase the coverage of general HIV testing services required to control transmission but did not cause rapid resurgence in HIV infections. Our modelling suggests that scaling back of general population HIV testing would not result in a resurgence of HIV infections, but would delay attainment of incidence-reduction targets and result in long-term increases in HIV infections, AIDS-related deaths, and costs (via increased need for ART provision). HIV programmes need to balance short-term potential resource savings with long-term epidemic control objectives. Bill & Melinda Gates Foundation.