It is located in Alifakovac, a neighborhood in Babića bašća local community, one of the oldest urban settlements in Sarajevo.
The mosque was built between 1541 and 1561 by Gazi Husrev-beg's quartermaster, Vekil-Harrach after whom it was originally named.
Hajži Mustajbeg Bešlija (-1799), a wealthy Sarajevo merchant, built a mekteb and a bakery next to the mosque, which were destroyed after World War I.
During the campaign of Eugene of Savoy against Sarajevo in October 1697, the mosque was burned down, but the residents of the Mahallah soon repaired it.
The preserved inscription has the form of a poem written in Turkish: "The owner of this property is the son of Mostar's Hamdi-effendi, a muderis, Mustafa-Fejzi, a kadi in the town of Binfše, who renovated this fountain.
The sofas and musandera were replaced, and the broken and damaged nišan tombstones in the mosque's harem were repaired.
[6] The mosque is fenced by a wall, inside which is a stone fountain, which was renewed at the beginning of the 19th century by Sarajevo judge (kadija) Mustafa Fevzi, which is what the inscription is about.