The magnetic compass of migrating birds is different from a normal terrestrial compass in that reversing the direction of the magnetic field leaves its reading unchanged. The birds detect the north-south plane as that containing the directions of the earth's magnetic field and gravity, and for north-south discrimination, and also possibly for a map sense of latitude, they detect the angle between the magnetic and gravitational axes within that plane. In this paper it is demonstrated that a biological compass with these characteristics is naturally formed if a biologically synthesized magnetite crystal becomes attached to a torque detector, such as a hair cell. Such a device has the required axial response, despite the polar response of a permanent magnet in a magnetic field, if it acts as a null detector of magnetic torque. It can also integrate at a single site the measurement of the directions of gravity and the magnetic field so that the angle between them is obtained directly.