Abstract. We severely criticize the consuetudinary analysis of the afterglows of gamma-ray bursts (GRBs) in the conical-ejection fireball scenarios. We argue that, instead, recent observations imply that the long-duration GRBs and their afterglows are produced by highly relativistic jets of cannonballs (CBs) emitted in supernova explosions. The CBs are heated by their collision with the supernova shell. The GRB is the boosted surface radiation the CBs emit as they reach the transparent outskirts of the shell. The exiting CBs further decelerate by sweeping up interstellar matter (ISM). The early X-ray afterglow is dominated by thermal bremsstrahlung from the cooling CBs, the optical afterglow by synchrotron radiation from the ISM electrons swept up by the CBs. We show that this model fits simply and remarkably well all the measured optical afterglows of the 15 GRBs with known redshift, including that of GRB 990123, for which unusually prompt data are available. We demonstrate that GRB 980425 was a normal GRB produced by SN1998bw, with standard X-ray and optical afterglows. We find that the very peculiar afterglow of GRB 970508 can be explained if its CBs encountered a significant jump in density as they moved through the ISM. The afterglows of the nearest 8 of the known-redshift GRBs show various degrees of evidence for an association with a supernova akin to SN1998bw. In all other cases such an association, even if present, would have been undetectable with the best current photometric sensitivities. This gives strong support to the proposition that most, maybe all, of the long-duration GRBs are associated with supernovae. Although our emphasis is on optical afterglows, we also provide an excellent description of X-ray afterglows.