<PAGE>
                                                                 Exhibit 10.4(f)

                        FIFTH AMENDMENT TO LOAN AGREEMENT
                        ---------------------------------

         This Fifth Amendment to Loan Agreement, dated this 27th day of October,
2003, by and among Michael Baker Corporation, a Pennsylvania corporation
("MBC"), Michael Baker, Jr., Inc., a Pennsylvania corporation ("Michael Baker
Jr."), Baker/MO Services, Inc., a Texas corporation ("Baker/MO"), Baker/OTS,
Inc., a Delaware corporation ("Baker/OTS"), Baker Engineering NY, Inc., a New
York corporation ("Baker NY") (each a "Borrower" and collectively, the
"Borrowers"), Citizens Bank of Pennsylvania (assignee of Mellon Bank, N.A.), a
Pennsylvania banking institution ("Citizens"), National City Bank of
Pennsylvania, a national banking association ("NCB"), and Fifth Third Bank, a
national banking association ("Fifth Third") (each a "Bank" and collectively,
the "Banks"), and Citizens Bank of Pennsylvania, as agent for the Banks (in such
capacity, the "Agent") ("Fifth Amendment").

                              W I T N E S S E T H:
                              --------------------

         WHEREAS, the Borrowers, the Banks and the Agent entered into that
certain Loan Agreement, dated September 5, 2001, as amended by (i) the First
Amendment to Loan Agreement, dated February 20, 2002, by and among the
Borrowers, the Banks and the Agent, (ii) the Second Amendment to Loan Agreement,
dated April 26, 2002, by and among the Borrowers, the Banks and the Agent, (iii)
the Third Amendment to Loan Agreement, dated July 31, 2002, by and among the
Borrowers, the Banks and the Agent and (iv) the Fourth Amendment to Loan
Agreement, dated March 24, 2003, by and among the Borrowers, the Banks and the
Agent (as amended, the "Loan Agreement"), pursuant to which, among other things,
the Banks agreed to extend credit to the Borrowers pursuant to a revolving
credit facility in an aggregate principal amount not to exceed Forty Million and
00/100 Dollars ($40,000,000.00); and

         WHEREAS, the Borrowers desire to amend certain provisions of the Loan
Agreement, and the Banks and the Agent shall permit such amendments pursuant to
the terms and conditions set forth herein.

         NOW, THEREFORE, in consideration of the premises contained herein and
other valuable consideration, the receipt and sufficiency of which are hereby
acknowledged, and intending to be legally bound hereby, the parties hereto agree
as follows:

         1.       All capitalized terms used herein which are defined in the
Loan Agreement shall have the same meaning herein as in the Loan Agreement
unless the context clearly indicates otherwise.

         2.       Section 1.01 of the Loan Agreement is hereby amended by
deleting the existing definition of "Expiry Date" and inserting the following
definition in its stead:

                  "Expiry Date" shall mean June 30, 2005 or such earlier date on
                  which the Revolving Credit Facility Commitment shall have been
                  terminated pursuant to this Agreement.

         3.       Section 1.01 of the Loan Agreement is hereby amended by
deleting the existing definitions of "Costs in Excess of Billings Ratio" and
"Total Revenue".

<PAGE>

         4.       Section 5.13(a) of the Loan Agreement is hereby deleted in its
entirety and in its stead is inserted the following:

                  (a) Minimum Owner's Equity. The Borrowers shall maintain at
                  all times Owner's Equity in an amount not less than the sum of
                  (i) Sixty-Seven Million Three Hundred Forty-Seven Thousand and
                  00/100 Dollars ($67,347,000.00) plus (ii) seventy-five percent
                  (75%) of Net Income of the Borrowers for the Fiscal Quarter
                  ending September 30, 2003 and each Fiscal Quarter thereafter
                  (excluding any net loss in any such Fiscal Quarter) at all
                  times.

         5.       Section 5.13(b) of the Loan Agreement is hereby deleted in its
entirety and in its stead is inserted the following:

                  (b) Leverage Ratio. As of December 31, 2003 and on the last
                  day of each Fiscal Quarter thereafter, for the period equal to
                  the four (4) consecutive Fiscal Quarters then ending, the
                  Borrowers shall maintain a Leverage Ratio in an amount not to
                  exceed 2.5 to 1.0. For purposes of this calculation only, the
                  definition of "EBITDA" shall exclude the non-recurring charges
                  that occurred during the period from October 1, 2002 through
                  June 30, 2003 as identified on the Summary of Non-Recurring
                  P/L Items attached hereto and made a part hereof as Exhibit
                  "A" (the "Non-Recurring Charges"); provided, however, for
                  purposes of the calculation of the Borrower's Leverage Ratio
                  pursuant to Section 2.02(a)(ii) of this Agreement, the
                  definition of "EBITDA" shall not exclude the Non-Recurring
                  Charges.

         6.       Section 6.14 of the Loan Agreement is hereby deleted in its
entirety.

         7.       The provisions of Sections 2 through 6 of this Fifth Amendment
shall not become effective until the Agent has received a fully-executed copy
this Fifth Amendment and such other documents as may be reasonably requested by
the Agent or the Banks.

         8.       Each Borrower hereby reconfirms and reaffirms all
representations and warranties, agreements and covenants made by it pursuant to
the terms and conditions of the Loan Agreement, except as such representations
and warranties, agreements and covenants may have heretofore been amended,
modified or waived in writing in accordance with the Loan Agreement.

         9.       The Borrowers have informed the Agent that as of September 30,
2003, the Borrowers' Cost in Excess of Billing Ratio was likely in excess of
1.35 to 1.0, and as of September 30, 2003, for the period equal to the four (4)
consecutive Fiscal Quarters then ending, the Borrowers' Leverage Ratio was
likely in excess of 2.5 to 1.0 and the Borrowers' Interest and Rent Coverage
Ratio was likely less than 1.25 to 1.00. Notwithstanding the foregoing, the
Borrowers have requested that the Agent and the Banks waive the specific Events
of Default described in the immediately preceding sentence that have occurred or
will occur



                                      -2-
<PAGE>

under the Loan Agreement. The Agent and the Banks hereby waive the specific
Events of Default that may have occurred under the Loan Agreement as described
in this Paragraph 9.

         10.      Each Borrower hereby represents and warrants to the Banks and
the Agent that (i) such Borrower has the legal power and authority to execute
and deliver this Fifth Amendment, (ii) the officers of such Borrower executing
this Fifth Amendment have been duly authorized to execute and deliver the same
and bind such Borrower with respect to the provisions hereof, (iii) the
execution and delivery hereof by such Borrower and the performance and
observance by such Borrower of the provisions hereof and of the Loan Agreement
and all documents executed or to be executed therewith, do not violate or
conflict with the organizational agreements of such Borrower or any Law
applicable to such Borrower or result in a breach of any provision of or
constitute a default under any other agreement, instrument or document binding
upon or enforceable against such Borrower, and (iv) this Fifth Amendment, the
Loan Agreement and the documents executed or to be executed by such Borrower in
connection herewith or therewith constitute valid and binding obligations of
such Borrower in every respect, enforceable in accordance with their respective
terms.

         11.      Subject to Paragraph 9 of this Fifth Amendment, each Borrower
represents and warrants that (i) no Event of Default exists under the Loan
Agreement, nor will any occur as a result of the execution and delivery of this
Fifth Amendment or the performance or observance of any provision hereof, (ii)
the Schedules attached to and made a part of the Loan Agreement are true and
correct in all material respects as of the date hereof, and (iii) it presently
has no known claims or actions of any kind at Law or in equity against the Banks
or the Agent arising out of or in any way relating to the Loan Documents.

         12.      Each reference to the Loan Agreement that is made in the Loan
Agreement or any other document executed or to be executed in connection
therewith shall hereafter be construed as a reference to the Loan Agreement as
amended hereby.

         13.      The agreements and waivers contained in this Fifth Amendment
are limited to the specific agreements made herein. Except as amended hereby,
all of the terms and conditions of the Loan Agreement shall remain in full force
and effect. This Fifth Amendment amends the Loan Agreement and is not a novation
thereof.

         14.      This Fifth Amendment may be executed in any number of
counterparts and by the different parties hereto on separate counterparts each
of which, when so executed, shall be deemed to be an original, but all such
counterparts shall constitute but one and the same instrument.

         15.      This Fifth Amendment shall be governed by, and shall be
construed and enforced in accordance with, the Laws of the Commonwealth of
Pennsylvania without regard to the principles of the conflicts of law thereof.
Each Borrower hereby consents to the jurisdiction and venue of the Court of
Common Pleas of Allegheny County, Pennsylvania and the United States District
Court for the Western District of Pennsylvania with respect to any suit arising
out of or mentioning this Fifth Amendment.


                                      -3-

<PAGE>



                  IN WITNESS WHEREOF, and intending to be legally bound, the
parties hereto have caused this Fifth Amendment to be duly executed by their
duly authorized officers as of the date above written.

<TABLE>

<S>                                                           <C>
Attest:                                                       Michael Baker Corporation

By:  /s/ Marcia S. Wolk                                       By: /s/ Craig O. Stuver
    -------------------------------------------------            --------------------------------------------------
Name:   Marcia S. Wolk                                        Name:  Craig O. Stuver
Title:  Vice President & Assistant Secretary                  Title:  Sr. Vice President & Corp. Controller



Attest:                                                       Michael Baker, Jr., Inc.

By: /s/ Marcia S. Wolk                                        By: /s/ Craig O. Stuver
   --------------------------------------------------            --------------------------------------------------
Name:   Marcia S. Wolk                                        Name:  Craig O. Stuver
Title:  Vice President & Assistant Secretary                  Title:  Sr. Vice President & Corp. Controller



Attest:                                                       Baker/MO Services, Inc.

By: /s/ Marcia S. Wolk                                        By: /s/ Craig O. Stuver
   --------------------------------------------------            --------------------------------------------------
Name:   Marcia S. Wolk                                        Name:  Craig O. Stuver
Title:  Vice President & Assistant Secretary                  Title:  Sr. Vice President & Corp. Controller



Attest:                                                       Baker/OTS, Inc.

By: /s/ Marcia S. Wolk                                        By: /s/ Craig O. Stuver
   --------------------------------------------------            --------------------------------------------------
Name:   Marcia S. Wolk                                        Name:  Craig O. Stuver
Title:  Vice President & Assistant Secretary                  Title:  Sr. Vice President & Corp. Controller


Attest:                                                       Baker Engineering NY, Inc.

By: /s/ Marcia S. Wolk                                        By: /s/ Craig O. Stuver
   --------------------------------------------------            --------------------------------------------------
Name:   Marcia S. Wolk                                        Name:  Craig O. Stuver
Title:  Vice President & Assistant Secretary                  Title:  Sr. Vice President & Corp. Controller
</TABLE>





<PAGE>



                              Citizens Bank of Pennsylvania, as Agent and
                              for itself as a Bank


                              By: /s/ John J. Ligday Jr.
                                 -----------------------------------------------
                              Name: John J. Ligday Jr.
                                   ---------------------------------------------
                              Title: Vice President
                                    --------------------------------------------


                              National City Bank of Pennsylvania


                              By: /s/ Richard D. Barnes
                                 -----------------------------------------------
                              Name: Richard D. Barnes
                                   ---------------------------------------------
                              Title: Vice President
                                    --------------------------------------------


                              Fifth Third Bank


                              By: /s/ C. S. Helmeci
                                 -----------------------------------------------
                              Name: Christopher S. Helmeci
                                   ---------------------------------------------
                              Title: Vice President
                                    --------------------------------------------