Where were castles first built?

The first castles ever built were in sri lanka.