In eukaryotic cells, incorrectly folded proteins in the endoplasmic reticulum (ER) are exported into the cytosol and degraded by the proteasome1. This pathway is co-opted by some viruses. For example, the US11 protein of the human cytomegalovirus targets the major histocompatibility complex class I heavy chain for cytosolic degradation2. How proteins are extracted from the ER membrane is unknown. In bacteria and mitochondria, members of the AAA ATPase family are involved in extracting and degrading membrane proteins3, 4. Here we demonstrate that another member of this family, Cdc48 in yeast and p97 in mammals, is required for the export of ER proteins into the cytosol. Whereas Cdc48/p97 was previously known to function in a complex with the cofactor p47 (ref. 5) in membrane fusion6, 7, 8, we demonstrate that its role in ER protein export requires the interacting partners Ufd1 and Npl4. The AAA ATPase interacts with substrates at the ER membrane and is needed to release them as polyubiquitinated species into the cytosol. We propose that the Cdc48/p97–Ufd1–Npl4 complex extracts proteins from the ER membrane for cytosolic degradation.