Is God’s Election Conditional or Unconditional?

The Bible teaches that God chooses those who believe. But is his choice based only on his own will, or on his knowledge of who will believe?