A group theoretic treatment of the geometric phase