We are developing a four-dimensional, image-guided radiotherapy system with a gimbaled x-ray head. The system has pursuing irradiation capability in addition to precise irradiation capability, owing to its agile x-ray head. The moving x-ray head requires a very small C-band accelerator guide. The heat intensity of the accelerator guide is much higher than that of conventional S-band medical linear accelerators. The resonance frequency varies over almost 1.0 MHz with a thermal time constant of about 30 s. An automatic frequency controller (AFC) is employed to compensate for this variation in resonance frequency. Furthermore, we noted that fast AFC response is important for step-and-shoot intensity modulation radiotherapy (IMRT), in which the beam is turned on and off frequently. Therefore, we invented a digital AFC, based on a new concept, to provide effective compensation for the thermal characteristics of the accelerator guide and to ensure stable and optimized x-ray treatment. An important aspect of the performance of the AFC is the capture-frequency range over which the AFC can seek, lock on to, and track the resonance frequency. The conventional, analog AFC used in S-band medical linear accelerators would have a capture-frequency range of about 0.9 MHz, if applied to our accelerator guide, and would be inappropriate. Conversely, our new AFC has a capture-frequency range of 24 MHz, which is well suited to our accelerator guide. The design concept behind this new AFC has been developed and verified. A full prototype system was constructed and tested on an existing accelerator guide at the rated x-ray output (500 cGy/min) of our radiotherapy system, with a pulse-repetition frequency of 300 Hz. The AFC acquired the resonance frequency of the accelerator guide within 0.15 s after beam-on, and provided stable tracking and adjustment of the frequency of the microwave source to the resonance frequency of the accelerator guide. With a planned improvement of the initialization of the AFC it should be able to acquire the resonance frequency within 33 ms.