A handrail assembly comprising a top bracket and a handrail pivotally connected to the top bracket. The handrail is movable relative to the top bracket between a stowed position and a deployed position. The handrail is able to be locked in position. The handrail can move between the stowed position and the deployed position when the handrail is not locked in position, but held in the stowed position or the deployed position when the handrail is not locked in position. The handrail cannot move between the stowed position and the deployed position when the handrail is locked in position.