Although different, each field can be obtained from a general law: Ampere’s Law .
When a current-carrying loop is placed in a magnetic field, the loop tends to rotate such that its normal becomes aligned with the magnetic field.