Majdal Yaba stood on the site of a walled city in 3000 BCE, and is first mentioned as Aphek in the Ancient Egyptian Execration texts of the 19th century BCE, as well as the 15th century topographical list of Thutmose III. According to biblical tradition, the Israelites under Joshua conquered Aphek from the Canaanites. With the Philistines advancing toward the city, the Israelites fled towards the hills of Samaria, and Aphek became the northernmost locality in Philistia. The Philistine army assembled in Aphek for two major battles against the Israelites, including the slaughter of Saul and Jonathan on Mount Gilboa and the capture of the Ark of the Covenant (1066 BCE) (). From then on, the city is not mentioned in the Bible, but the Assyrians and the Babylonians mention it as a stronghold in the 7th century BCE.