The mosque was actually built by an orientalist named Dr Gottlieb Wilhelm Leitner. He was born of Jewish parents in Pest, Hungary.
His father died young and his mother moved to Istanbul where she re-married a Jew who had converted to Christianity and was working with a Protestant Missionary Society in the Levant.
For reasons that are not clear Leitner studied at madrassah schools attached to the mosques in Istanbul, and by his own account memorised large portions of the Quran. By the age of 15 he could speak 8 languages fluently including Turkish, Persian, Arabic and most European languages. On account of this he was employed as Interpreter First Class by the British High Commission in Istanbul, a position that carried the rank of full colonel.
'Quilliams Liverpool mosque pre-dates Woking by a few months, but the Shah Jahan has the honour of being the first purpose built mosque in Europe outside of Muslim Spain.'
Dr Leitner came to England aged 17 and took a degree at Kings College London, by which time it is said he could speak 15 languages. After his degree he was appointed lecturer aged 19 and by the age of 21 was professor at the same college, in Arabic and Muhammadan Law. At the age of 24 he took up the post of Principle of the Government College Lahore, later the University of the Punjab. He spent most of his working life there, published journals and established libraries and educational institutes. He also befriended many notables.
He returned to England with the express purpose of establishing here an Oriental Institute. His search for suitable premises brought him to Woking, at that time a very under developed commuter town 30 miles from London. He purchased what had been the Royal Dramatic College, a large Victorian building in extensive grounds that had been built as a retirement home for retired actors. This project had not been successful but the building was ideal for Leitner's purposes. Here in 1883 he established his Oriental Institute and with a donation from the Begum Shah Jahan, the Nawab Begum of the princely state of Bhopal, built England's first mosque in 1889.
The purpose of the Institute was to enable visiting dignitaries from India to stay and study in culturally sympathetic surroundings. It also enabled Europeans being posted to India to learn the language and culture.
By the time of Leitner's death in 1899 the Institute was awarding degrees through its affiliation to the University of the Punjab. After his death the Institute closed down and was sold and the mosque fell into disuse. Although there is no clearly documented evidence that he himself accepted Islam he was none the less an active sympathiser and supporter.