Why does مَسَاجِدِ have kasra in بِمَسَاجِدِ الْمَدِينَةِ?

Munṣarif and Ghayr Munṣarif — Definitions, Causes and Parsing