Igneous rocks are formed when magma or lava cools and solidifies. The type of igneous rock that is formed depends on the composition of the magma or lava and the conditions under which it cools.