What was the first animal to lay an egg that hatched outside the body of the mother?

Why did that happen? What caused it?
Update: Amniotes?
Update 2: The first egg in a shell.
0