The kasra in «بِمَسَاجِدِ الْمَدِينَةِ» is incorrect because masājid is a diptote.

Diptote Causes — Ultimate Broken-Plural Patterns