Counterscarp

In less permanent fortifications, the counterscarp may be lined with paling fence set at an angle so as to give no cover to the attackers but to make advancing and retreating more difficult.

[1][2] These are tunnels or "galleries" that have been built behind the counterscarp wall inside the moat or ditch.

Each gallery is pierced with loopholes for musketry, so that attacking forces that enter the moat can be directly fired upon.

Counterscarp galleries were usually built into the angles of the ditch to give the widest field of fire.

Occasionally, casemated artillery batteries were built into the counterscarp, but they were more commonly designed for infantry weapons only.

Counterscarp of a Napoleon era polygonal fort ( Fort Napoleon, Ostend ). Counterscarps had become vertical by this time. The housing at the bottom of the ditch is a caponier from where the defenders could fire on attackers that managed to climb down into the ditch, while being protected from cannon fire themselves.
The counterscarp gallery at Southsea Castle in Portsmouth , England