From the early 1600s, a rat was someone who deserted and went over to the other side. Hence, a rat was a deceiver, a traitor, and not to be trusted. This figurative use of the word derived from the perceived behaviour of rats aboard ships and in houses. Rats would invariably make their homes aboard ships and in houses, but were remarkably quick off the mark to abandon a ship when it might be sinking or fleeing from a house on fire. They could hardly be blamed for this, but even so, they became synonymous with deserters or deceivers and gave rise to host of 'rat' expressions including, of course, the definitive one ' like rats leaving a sinking ship’, which has been used figuratively since the early 17th century. To 'smell a rat' meaning to suspect something suspicious or wrong is even older and dates from the 1500s. To 'rat on' someone, meaning to inform on them or betray them dates from the late 18th/early 19th century.