Complex sentence: Muhammad did not enter Medina directly, but stopped at a nearby place called Quba, and established the Quba Mosque, the first mosque of Islam.
Split into simpler sentences: Muhammad did not enter Medina directly, but stopped at its outlying environs of Quba. He established the Quba Mosque there, the first mosque of Islam.