Background: There are few data on the epidemiology of primary HIV-1 drug resistance after the roll-out of antiretroviral treatment (ART) in sub-Saharan Africa. We aimed to assess the prevalence of primary resistance in six African countries after ART roll-out and if wider use of ART in sub-Saharan Africa is associated with rising prevalence of drug resistance. Methods: We did a cross-sectional study in antiretroviral-naive adults infected with HIV-1 who had not started first-line ART, recruited between 2007 and 2009 from 11 regions in Kenya, Nigeria, South Africa, Uganda, Zambia, and Zimbabwe. We did population-based sequencing of the pol gene on plasma specimens with greater than 1000 copies per mL of HIV RNA. We identified drug-resistance mutations with the WHO list for transmitted resistance. The prevalence of sequences containing at least one drug-resistance mutation was calculated accounting for the sampling weights of the sites. We assessed the risk factors of resistance with multilevel logistic regression with random coefficients. Findings: 2436 (94.1%) of 2590 participants had a pretreatment genotypic resistance result. 1486 participants (57.4%) were women, 1575 (60.8%) had WHO clinical stage 3 or 4 disease, and the median CD4 count was 133 cells per μL (IQR 62-204). Overall sample-weighted drug-resistance prevalence was 5.6% (139 of 2436; 95% CI 4.6-6.7), ranging from 1.1% (two of 176; 0.0-2.7) in Pretoria, South Africa, to 12.3% (22 of 179; 7.5-17.1) in Kampala, Uganda. The pooled prevalence for all three Ugandan sites was 11.6% (66 of 570; 8.9-14.2), compared with 3.5% (73 of 1866; 2.5-4.5) for all other sites. Drug class-specific resistance prevalence was 2.5% (54 of 2436; 1.8-3.2) for nucleoside reverse-transcriptase inhibitors (NRTIs), 3.3% (83 of 2436; 2.5-4.2) for non-NRTIs (NNRTIs), 1.3% (31 of 2436; 0.8-1.8) for protease inhibitors, and 1.2% (25 of 2436; 0.7-1.7) for dual-class resistance to NRTIs and NNRTIs. The most common drug-resistance mutations were K103N (43 [1.8%] of 2436), thymidine analogue mutations (33 [1.6%] of 2436), M184V (25 [1.2%] of 2436), and Y181C/I (19 [0.7%] of 2436). The odds ratio for drug resistance associated with each additional year since the start of the ART roll-out in a region was 1.38 (95% CI 1.13-1.68; p=0.001). Interpretation: The higher prevalence of primary drug resistance in Uganda than in other African countries is probably related to the earlier start of ART roll-out in Uganda. Resistance surveillance and prevention should be prioritised in settings where ART programmes are scaled up. Funding: Ministry of Foreign Affairs of the Netherlands.