Vishwamitra was a Kshatri and Vasishtha was a Brahmin. In order to possess Nandini, Vishwamitra wanted to become a Brahm-rishi like Vasishtha, but his royal pride stood in his way. In great ego, he even killed the sons of Vasishtha. But ultimately when he became modest and humble, Vasishtha assisted him and he became a Brahm-rishi. According to Manu, Vasishtha was one of the seven great rishis and also one of the ten prajapatis.
References :
1. Kohli, Surindar Singh, Dictionary of Mythological References in Guru Granth Sahib, 1993