In recent years we have become aware of the hazard posed by impacts of asteroids and comets on our planet. Although the annual probability of such an impact is very small, the consequences could be so severe that it is wise to study this threat and its possible countermeasures. Work is being done in order to discover all the potential impactors large enough to be of concern, and to study their motion to verify that they are not going to fall on the Earth in the next decades/centuries. The discovery work is done by a number of small telescopes in various continents (mostly in the Northern hemisphere), while the dynamical studies are carried out in a very small number of very specialized centres. In this talk I review the current status of the discovery and follow-up activities going on worldwide, and will describe some recent advances in the theory of close encounters, between small bodies and the Earth, that lead to feasible strategies to deflect an impactor.