Marsh & McLennan Cos. said Wednesday it recorded a loss in the second quarter because of an impairment charge tied to the value of one of its divisions.

Excluding the special charge, Marsh & McLennan was able to turn a profit that narrowly beat analysts’ expectations as the New York-based insurance broker and consulting firm said profitability improved in its core risk and insurance services segment.