In Shakespeare's Richard III, Gloucester is portrayed very much as a Machiavellian character. In his pursuit of the English throne, Gloucester commits any act that will move him closer to his desired goal. As the play opens, it is made clear to the reader/viewer that Gloucester is not a character to be trusted, and this view is shared even by his family members at court. Edward IV, the ruler of England when the play opens, demands a great deal of loyalty from those who serve him. Lord Hastings is one of Edward's most ardent supporters.
Once the king dies, Hastings shifts his loyalty to his sons, the two young princes Edward (later Edward V) and Richard. Hastings does not realize that Gloucester has aspirations for the throne, so he trusts him to act in the best interests of the two princes. When the king and his brother Clarence are dead, Gloucester is named the protector for the young princes, a decision with which Hastings has relatively little concern. When Gloucester suggests that he, rather than Edward, the Prince of Wales, should become king (as a matter of national security), Hastings tells Gloucester's servant Catesby that he will not grant his support for such a move.
Gloucester, being as ruthlessly political as he is, machinates a situation to ensnare Hastings and remove further opposition to his plans. He conjures up charges of treason against Hastings and has him executed. Gloucester assumes that Hastings's lack of support automatically makes him an enemy - and therefore an obstacle - to his larger goal: the English throne.
He imprudently tells Richard's ally Catesby that he would never support Richard as king instead of the prince of Wales. Consequently, Richard trumps up a charge of treason against Hastings and has him assassinated.