In an action to foreclose a mortgage of real property, the court must allow as a part of the costs a reasonable attorney's fee, which shall be fixed by the court, any stipulation in the instrument or any agreement between the parties to the contrary notwithstanding. First Security cites to In Farm Credit Bank of Spokane v. Newton, 252 Mont. 336, 829 P.2d 931, 932 (1992); Graham v. Superior Mines, 100 Mont. 427, 49 P.2d 443, 445 (1935); and Bermes v. Sylling, 179 Mont. 448, 464, 465, 587 P2d 377, 385, 386 (1978), to support the foregoing argument. Such cases are distinguishable.