That's not quite correct.
In January 2006 the Palestinian territories held what turned out to be their last parliamentary elections. Hamas won a bare plurality of votes (44 percent to the more moderate Fatah party’s 41 percent) but, given the electoral system, a strong majority of seats (74 to 45).
As neither party was keen on sharing power fighting broke out between the two. When a unity government was finally formed in June 2007, Hamas broke the deal, started murdering Fatah members, and, in the end, took total control of the Gaza Strip.
Those who weren’t killed fled to the West Bank, and the territories have remained split ever since.