On the origin of gravity