The radio and X-ray observations of SN 1993J during the first year can be consistently explained as a result of interaction of the expanding ejecta with a circumstellar medium. The density of the circumstellar gas can be deduced from the free-free absorption of the radio emission and from the X-ray luminosity. During the first 2 weeks, both sets of observations indicate a mass loss-rate of similar to 4 x 10(-5) M. yr(-1) for a wind velocity of 10 km s(-1). The subsequent radio and X-ray observations indicate a density gradient proportional to r(-s), with 1.5 less than or similar to s less than or similar to 1.7, as opposed to the r(-2) gradient expected for a steady, spherically symmetric wind. This may be caused either by a variation of the mass-loss rate from the progenitor system or by a non-spherically symmetric geometry. To explain the properties of the X-ray emission, a steep density gradient in the ejecta is needed. During the first months, most of the observed X-ray emission originates from the circumstellar shock, which is adiabatic, while the reverse shock is radiative. To avoid excessive Comptonization in the X-ray range collisionless heating must be ineffective. The soft X-rays observed at 220 days probably originate from the reverse shock. The ionization and temperature structures of the circumstellar gas are calculated; we find that the temperature is in excess of 10(5) K and the medium is nearly completely ionized by the shock radiation after the formation of the shocks. Preacceleration of the circumstellar gas by the radiation from the outbreak can explain the observed high velocity for the circumstellar N v and H alpha lines. The high luminosity of the lines indicates that the circumstellar medium close to the supernova progenitor had a complex structure.