In Iraq and Palestine and the UK and the US, the mosque is also a place to store weapons and ammunition and prisoners and teach Tae Kwon Doe. Some mosques had also been used to torture and execute infidels and misguided believers. Brainwashing suicide bombers mostly start and often is carried in an extremist mosque. I believe that you should add a Third purpose for the mosque. You mention prayers and funerals, you should also consider a 'Community Center'.
Years ago, I attended a new mosque, daily, for 40-50 hours, for six months, together with around 50 of my 'companions'.
Some were athiests, some Christians. Might have had a few Jews in the party as well.
Every muslim I met was congratulating me on being the 'chosen one'.
"See how Allah has chosen you to enlighten? You are indeed blessed."
I was well pleased. My companions celebrated with pork sandwiches.
After the six months were over, I spoke to the caretaker:
"There you go sir... The electrical, plumbing, and security systems of the mosque are now complete."

It was a huge mosque, with 3 floors. A floor for the women. A floor for the men. A floor for functions.
sarcasm begin:
A breeding place for criminal activity.
I can't tell you about the installations to the hidden rooms; the dungeons, Baal.

/end
Criminals don't need a Mosque to operate. They can do it in the President's or Prime Minister's office.