The problem of the origin and nature of the galactic magnetic field is of fundamental interest. The astrophysical consequences of this field are far-reaching, being particularly relevant to the unsolved problem of the origin of cosmic rays. An analysis is made of the small-scale and large-scale feature, of the distribution of arrival directions of ultra-high-energy cosmic rays in the hope of deducing information about their sources and the strength and degree of irregularity of galactic and intergalactic oiagnetic fields. The outcome of these statistical searches is negative. After a review of the basic ideas of the turbulent dynamo, techniques are developed for performing numerical experiments upon the galactic dynamo. The results of these experiments indicate that dynamo action can occur in the galaxy and a steady solution is most easily excited. The dependence of the models upon boundary conditions and relevant astrophysioal parameters is investigated. An attempt is made to simulate the nonlinear effect of suppression of turbulence by the magnetic field, which is incorporated into the model proposed for the Galaxy. The propagation of ultra-high-energy cosmic rays is examined for this . model. It is found that these particles cannot be of Galactic origin if they are protons, in agreement with the results obtained from conventional field models. Comparisons are made between the predictions of the dynamo models and the observed synchrotron radiation from the Galaxy and external galaxies which shed some light upon the nature of the intergalactic medium