How did castling originate? Castling to me has always seemed like such a huge leap in terms of game play that I've always wondered how it came to be. 

Does anyone know the history behind how and why castling came to be?
Per Wikipedia:

Castling was added to European chess in the 14th or 15th century and did not develop into its present form until the 17th century. The Asian versions of chess do not have such a move.

The King seems to have always moved the same as at the present, except that the game used to be played until he was actually captured. Because of the King's vulnerability due to the Queen's enormous scope and power, several methods of "castling" were tried before the 16th century.

One method was to allow the King to move two or three squares on its initial move.
Another method was to allow the King to move directly to g2. 
The present method of castling was documented as early as Ruy López's 1561 work Libro de la invención liberal y arte del juego del Axedrez.