EXHIBIT 10.17

                               GUARANTY AGREEMENT

                  GUARANTY AGREEMENT, dated as of May 25, 1995 (as amended,
supplemented or otherwise modified from time to time, this "Guaranty"), made by
CASTLE ENERGY CORPORATION, a corporation organized and existing under the laws
of the State of Delaware ("CEC"), CASTLE PRODUCTION RESOURCE COMPANY, a
corporation organized and existing under the laws of the State of Pennsylvania
("CPRC") and CASTLE PRODUCTION COMPANY, a corporation organized and existing
under the laws of the State of Texas ("CPC," and, together with CEC and CPRC,
the "Guarantors"), in favor of BT COMMERCIAL CORPORATION ("BTCC"), as
Administrative Agent (in such capacity, the "Agent") for each of the Line of
Credit Lenders (BTCC and MeesPierson N.V., New York Agency) and Bankers Trust
Company, as Issuing Lender (collectively, and together with any assignees of
such lenders, the "Lender Parties") parties to the Letter Agreement (as
hereinafter defined). Capitalized terms used herein without definition shall
have the meanings assigned to such terms in the Letter Agreement.

                             W I T N E S S E T H :

                  WHEREAS, under the terms of a Letter Agreement, dated as of
the date hereof (as the same may be amended, amended and restated, supplemented
or otherwise modified from time to time, the "Letter Agreement"), among the
Lender Parties, BTCC, as Administrative Agent and Collateral Agent, and Indian
Oil Company (the "Borrower") , the Lender Parties have granted to the Borrower a
line of credit of up to $30,000,000 in revolving loans and letters of credit;

                  WHEREAS, CEC is the owner of all of the issued and outstanding
common stock, par value $.01 per share, of the Borrower (the "Borrower Common
Stock") and all of the issued and outstanding capital stock of CPRC and CPC, and
in recognition of certain benefits to be received by CEC, CPRC and CPC in
connection with the availability of the line of credit to the Borrower, the
Guarantors desire to absolutely, unconditionally and irrevocably guarantee the
payment and all other obligations of the Borrower under and in connection with
the Letter Agreement and the line of credit granted pursuant thereto;

                  WHEREAS, in connection herewith the Guarantors have entered
into that certain Pledge Agreement, dated as of the date hereof, pursuant to
which, among other things, as security for the performance of their obligations
under this Guaranty, the Guarantors have pledged to the Agent for the benefit of




itself and the Lender Parties the Borrower Common Stock, all limited and general
partnership interests of the Guarantors in Castle Texas Production L.P. and all 
of the outstanding capital stock of CPRC, CPC and Castle Exploration Company, 
Inc.

                  NOW, THEREFORE, as an inducement to the Agent and the Lender
Parties to execute and deliver the Letter Agreement and extend to the Borrower
the line of credit and, in recognition of the substantial direct and indirect
benefit from the transactions contemplated by the Letter Agreement, the
Guarantors hereby jointly and severally agree with the Agent for the benefit of
itself and the Lender Parties as follows:

                  SECTION 1. Guaranty. The Guarantors hereby unconditionally,
absolutely, continuingly and irrevocably guarantee on a joint and several basis
to the Agent for the benefit of the Lender Parties the full and punctual payment
when due (upon demand or otherwise) of all obligations and liabilities of the
Borrower of any kind owing to the Agent or any Lender Party, whether now or
hereafter owing or required to be paid to the Agent or any Lender Party, in
respect of or under the Letter Agreement, the Notes, the Collateral Documents or
any other document, instrument or certificate delivered by the Borrower in
connection with the Letter Agreement and the line of credit granted thereunder
(collectively, the "Line Documents"), whether or not the right of the Agent or
such Lender Party to payment in respect of such claim is reduced to judgment,
liquidated or unliquidated, fixed, contingent, matured, disputed, undisputed,
legal, equitable, secured or unsecured, and whether or not such claim is
discharged, stayed or otherwise affected by any proceeding seeking to adjudicate
the Borrower bankrupt or insolvent, or seeking liquidation, winding up,
reorganization, arrangement, adjustment, protection, relief, or consolidation of
it or its debts under any law relating to bankruptcy, insolvency or
reorganization or relief of debtors, or seeking the entry of an order for relief
or the appointment of a receiver, trustee, custodian or other similar official
for it or for any substantial part of its property (collectively, the
"Obligations"). Without limiting the generality of the foregoing, the
Obligations include the obligation of the Borrower to pay principal, interest
(including interest accruing on or after any assignment for the benefit of
creditors, the issuing of a notice of intention to make a proposal or the making
of a proposal under the United States Bankruptcy Code, the filing of any
petition in bankruptcy, or the commencement of any insolvency, reorganization or
like proceeding relating to the Borrower, whether or not a claim for such
post-filing or post-petition interest is allowed), reimbursement obligations,
letter of credit fees or commissions, charges, expenses, fees, reasonable
attorneys' fees and disbursements, indemnities and other present and future
amounts payable by the Borrower to the Agent or any Lender Party in respect of
or under any Line Document. Without limiting the generality of the foregoing,
each Guarantor's liability shall extend to all amounts that constitute part of
the Obligations and would be owed by the Borrower to the Agent or any Lender
Party but for the fact that they are unenforceable or not allowable due to the
existence of a bankruptcy, reorganization or similar proceeding involving the

                                      -2-




Borrower. Anything herein to the contrary notwithstanding, the maximum 
liability of each Guarantor hereunder shall in no event exceed the amount which
can be guaranteed by such Guarantor under applicable federal and state laws 
relating to the insolvency of debtors.

                  SECTION 2. Guaranty Absolute and Unconditional. The Guarantors
guarantee that, with respect to the Agent and each Lender Party, the Obligations
will be paid strictly in accordance with the terms of the Letter Agreement and
the other Line Documents, regardless of any law, regulation or order now or
hereafter in effect in any jurisdiction affecting any of such terms or the
rights of the Agent or any Lender Party with respect thereto. This Guaranty is
one of payment and performance and not collection and the obligations of each
Guarantor under this Guaranty are independent of the Obligations, and a separate
action or actions may be brought and prosecuted against each Guarantor to
enforce this Guaranty, irrespective of whether any action is brought against the
Borrower or any other Guarantor or other guarantor or whether the Borrower or
any other Guarantor or guarantor is joined in any such action or actions. The
liability of each Guarantor under this Guaranty shall be absolute and
unconditional irrespective of:

          (i) any lack of validity or enforceability of any contractual or other
     agreement, instrument or document including, without limitation, the Letter
     Agreement, any of the other Line Documents, any of the Obligations, or any
     guarantee thereof;

          (ii) any change in the time, manner or place of payment of, or in any
     other terms of, all or any of the Obligations, or any other amendment or
     waiver of or any consent to departure from any contractual or other
     agreement between the Borrower and the Agent or any Lender Party or any
     instrument or document relating thereto, including, without limitation, any
     increase in the Obligations resulting from the extension of additional
     credit to the Borrower or otherwise;

          (iii) any taking, exchange, release or non-perfection of any
     Collateral, or any taking, release or amendment or waiver of or consent to
     or departure from any other guaranty (including this Guaranty with respect
     to any other Guarantor), for all or any of the Obligations;

          (iv) any failure of any other Guarantor or guarantor to satisfy its
     obligations in respect of any Obligations;

          (v) any manner of application of Collateral securing any Obligation,
     or proceeds thereof, to all or any of the Obligations, or any manner of
     sale or other disposition of any Collateral for all or any of the
     Obligations or any other assets of the Borrower;

                                      -3-


          (vi) any change, restructuring or termination of the corporate
     structure or existence of the Borrower;

          (vii) any failure or delay of the Agent or any Lender Party to
     exercise any right or remedy under this Guaranty, the Letter Agreement or
     the other Line Documents or with respect to the Collateral or any other
     property or assets pledged to the Agent for the benefit of the Lender
     Parties under any Line Document;

          (viii) any creditors' rights, bankruptcy, receivership or other
     insolvency proceeding of the Borrower or in respect of the property of the
     Borrower or any merger, consolidation, reorganization, dissolution,
     liquidation or winding up of the Borrower;

          (ix) impossibility or illegality of performance on the part of the
     Borrower of its obligations under the Letter Agreement, any Notes or any
     other Line Document;

          (x) in respect of the Borrower, any change of circumstances, whether
     or not foreseen or foreseeable, whether or not imputable to the Borrower,
     or other impossibility of performance through fire, explosion, accident,
     labor disturbance, floods, droughts, embargoes, wars (whether or not
     declared), civil commotions, acts of God or the public enemy, delays or
     failure of suppliers or carriers, inability to obtain materials, action of
     any federal or state regulatory body or agency, change of law or any other
     causes affecting performance, or any other force majeure, whether or not
     beyond the control of the Borrower and whether or not of the kind
     hereinbefore specified;

          (xi) any order, judgment, decree, ruling or regulation (whether or not
     valid) of any court of any nation or of any political subdivision thereof
     or any body, agency, department, official or administrative or regulatory
     agency of any thereof which shall delay, interfere with, hinder or prevent,
     or in any way adversely affect, the performance of the Borrower's
     obligations under the Letter Agreement or any Note or any other Line
     Document;

          (xii) the failure of such Guarantor to receive any consideration from
     or as a result of its execution, delivery and performance of this Guaranty
     or the Pledge Agreement; or

  

                                      -4-


          (xiii) any other circumstance which might otherwise constitute a
     defense available to, or a discharge of, the Borrower, such Guarantor or
     any other Guarantor or guarantor with respect to the Obligations
     (including, without limitation, all defenses based on suretyship or
     impairment of collateral, and all defenses that the Borrower may assert to
     the repayment of the Obligations, including, without limitation, failure of
     consideration, breach of warranty, fraud, statute of frauds, bankruptcy,
     lack of legal capacity, statute of limitations, lender liability, accord
     and satisfaction, and usury) or which might otherwise constitute a defense
     to this Guaranty and the obligations of such Guarantor under this Guaranty.

This Guaranty shall continue to be effective or be reinstated, as the case may
be, if at any time any payment of any of the Obligations is rescinded or must
otherwise be returned by the Agent or any Lender Party upon the insolvency,
bankruptcy or reorganization of the Borrower or otherwise, all as though such
payment had not been made. Each Guarantor agrees that if the Borrower or any
other guarantor of all or a portion of the Obligations is the subject of a
bankruptcy proceeding under Title 11 of the United States Code or similar laws
affecting creditors' rights or insolvent corporations, it will not assert the
pendency of such proceeding or any order entered therein as a defense to the
timely payment of the Obligations.

                  SECTION 3. Waivers. (a) Each Guarantor hereby waives
promptness, diligence, notice of acceptance and any other notice with respect to
any of the Obligations and this Guaranty and any requirement that the Agent or
any Lender Party protect, secure, perfect or insure any lien securing any
Obligation or any property subject thereto or exhaust any rights or take any
action against the Borrower or any other individual, corporation, partnership or
other legal entity ("Persons") or any collateral. Each Guarantor hereby waives
notice of or proof of reliance by the Agent or any Lender Party upon this
Guaranty, and the Obligations shall conclusively be deemed to have been created,
contracted, incurred, renewed, extended, amended or waived in reliance upon this
Guaranty.

                   (b) Each Guarantor hereby agrees that, until such time as the
Obligations and all such Guarantor's obligations hereunder are paid in full in
cash, and the Letter Agreement and the other Line Documents are terminated and
the expiry or cancellation (undrawn) of all Letters of Credit (other than those
that are Adequately Collateralized) (the "Termination Date"), it shall not
assert any claim or other right that it may now or hereafter acquire against the
Borrower or any other insider guarantor that arises from the existence, payment,
performance or enforcement of such Guarantor's obligations under this Guaranty
or the Letter Agreement, the other Line Documents or the Obligations or
guarantees thereof, including, without limitation, any right of subrogation,
reimbursement, exoneration, contribution or indemnification and any right to
participate in any claim or remedy of the Agent or any Lender Party against such
Guarantor, any other insider guarantor or any collateral securing any Guaranteed
Obligation, whether or not such claim, remedy or right arises in equity or under
contract, statute or common law, including, without limitation, the right to
take or receive from such Guarantor or any other insider guarantor, directly or


                                      -5-



indirectly, in cash or other property or by set-off (including under Section 10
hereof) or in any other manner, payment or security on account of such claim,
remedy or right. If any amount shall be paid to such Guarantor in violation of
the preceding sentence at any time prior to the payment in full in cash of the
Obligations and all other amounts payable under this Guaranty, such Guarantor
shall immediately give the Agent notice of its receipt of such amount and such
amount shall be held in trust for the benefit of the Agent and the Lender
Parties owed the Obligations which gave rise to such Guarantor's right of
recovery, segregated from other funds of such Guarantor, and shall forthwith be
paid to the Agent to be credited and applied to the Obligations then due and
payable and all other amounts payable under this Guaranty then due and payable,
whether matured or unmatured, in such order as the Agent may determine. Each
Guarantor acknowledges that it will receive direct and indirect benefits from
the Letter Agreement and the transactions consummated in connection therewith
and that the waiver set forth in this subsection is knowingly made in
contemplation of such benefits.

                   (c) Until all of the Obligations shall have been paid in full
in cash, no Guarantor will enforce any other claim or exercise any other rights
which it may have against the Borrower.

                  SECTION 4. Payments Free and Clear of Taxes, Etc. (a) Any and
all payments made by the Guarantors hereunder to or for the benefit of any
Lender Party or the Agent shall be made free and clear of and without deduction
for any and all present or future taxes (other than any taxes imposed on the
gross receipts or income of any Lender Party or to the Agent). If any Guarantor
shall be required by law to deduct any such taxes from or in respect of any sum
payable hereunder, to or for the benefit of any Lender Party or the Agent, (i)
the sum payable shall be increased as may be necessary so that after making all
required deductions of such taxes (including deductions of taxes applicable to
additional sums payable under this Section) such Lender Party or the Agent, as
the case may be, receives an amount equal to the sum it would have received had
no such deductions been made, (ii) such Guarantor shall make such deductions and
(iii) such Guarantor shall pay the full amount so deducted to the relevant
taxation authority or other authority in accordance with applicable law.

                   (b) In addition, each Guarantor agrees to pay any present or
future stamp, documentary, excise, privilege, intangible or similar levies that
arise at any time or from time to time (i) from any payment made under any and
all Line Documents, (ii) from the transfer of the rights of any Lender Party
under any Line Documents to any transferee, or (iii) from the execution or
delivery by the Borrower of, or from the filing or recording or maintenance of,
or otherwise with respect to the exercise by the Agent or the Lender Parties of
their rights under, any and all Line Documents (hereinafter referred to as
"Other Taxes").
                                      -6-



                   (c) The Guarantors hereby indemnify each Lender Party and the
Agent with respect to any taxes referred to in (a) and (b) of this Section 4
paid by such Lender Party or the Agent, as the case may be, and any liability
(including penalties, interest and expenses) arising solely therefrom or with
respect thereto. Payment of this indemnification shall be made within 30 days
from the date such Lender Party or the Agent certifies and sets forth in
reasonable detail the calculation thereof as to the amount and type of such
taxes. Any such certificate submitted by the Lender Party or the Agent in good
faith to the Borrower shall, absent manifest error, be final, conclusive and
binding on all parties.

                   (d) Within thirty days after having received a receipt of
taxes, each Guarantor will furnish to the Agent or the applicable Lender Party,
at its address referred to in Section 8 hereof, the original or a certified copy
of a receipt evidencing payment thereof.

                   (e) Without prejudice to the survival of any other agreement
of the Guarantors hereunder, the agreements and obligations of the Guarantors
contained in this Section 4 shall survive the Termination Date.

                  SECTION 5.  Representations and Warranties.  Each Guarantor 
hereby represents and warrants as follows as to itself:

                   (a) The Guarantor is a corporation duly organized, validly
existing and in good standing under the laws of its state of incorporation and
has the requisite power and authority to own or lease and operate its
properties and to carry on its business as now conducted and as proposed to be
conducted. The Guarantor is duly qualified and is authorized to do business and
is in good standing in each jurisdiction where the nature of its business or
location of its properities and assets requires it to be so qualified.

                   (b) The execution and delivery by the Guarantor of this
Guaranty and any other Line Document to which it is a party and the performance
by the Guarantor of its obligations hereunder and thereunder are within the
Guarantor's corporate powers, have been duly authorized by all necessary action
and do not and will not (i) require any consent or approval of the stockholders
of the Guarantor, (ii) contravene (A) the Guarantor's Certificate of
Incorporation, By-laws or similar organizational documents, (B) any statute or
any order, rule or regulation of any court or governmental agency or body (a
"Governmental Authority") having jurisdiction over the Guarantor or any of its
properties or assets ("Requirements of Law"), (C) any franchise, license,
permit, indenture, contract, lease, agreement, instrument or other commitment to
which it is a party or by which any of its properties or assets are bound
("Contractual Provisions"), or (iii) result in or require the creation or
imposition of any lien or encumbrance upon or with respect to any of the
Guarantor's properties or assets, except for the liens in favor of the
Collateral Agent created, for the benefit of the Collateral Agent and the Lender
Parties, under the Collateral Documents. The Guarantor is not in default under
any Contractual Provision nor has the Guarantor violated or failed to comply
with any Requirement of Law which would, individually or in the aggregate, be
reasonably likely to have a material adverse effect on the financial condition
of the Guarantor or its ability to perform its obligations under this Guaranty
or the Pledge Agreement (a "Material Adverse Effect").


                                      -7-




                   (c) No consent, authorization, approval or filing with any
Governmental Authority or third party is required in connection with the
execution, delivery and performance by the Guarantor of this Guaranty, the
Pledge Agreement or any other Line Document to which it is a party, except for
the filings, if any, necessary to create, perfect or retain the perfection of
liens against the Collateral.

                   (d) This Guaranty and each of the Line Documents to which the
Guarantor is a party is the legal, valid and binding obligation of the Guarantor
enforceable against the Guarantor in accordance with its terms, except as
enforceability may be limited by bankruptcy, insolvency or similar laws
affecting creditors' rights generally and general equitable principles.

                   (e) There is not now outstanding with respect to the
Guarantor nor is there now pending or, to the best of the Guarantor's knowledge
after diligent inquiry, threatened any litigation, contested claim,
investigation, arbitration, or governmental proceeding, by or against the
Guarantor, that (i) could individually or in the aggregate, be reasonably likely
to have a Material Adverse Effect (other than the litigation commenced by Shell
Canada Ltd. et al. against Indian Refining Limited Partnership et al. and the
pending or threatened arbitration between CEC, Inc. and MG Refining & Marketing
Inc., or (ii) purports to affect the legality, validity or enforceability of
this Guaranty or any other Line Document to which the Guarantor is a party or
the consummation of the transactions contemplated hereby or thereby.

                   (f) The Guarantor has, independently and without reliance
upon the Agent or any Lender Party and based on such documents and information
as it has deemed appropriate, made its own credit analysis and decision to enter
into this Guaranty.

                   (g) The performance of the Guarantor's obligations under this
Guaranty and the other Line Documents to which it is a party would not render it
Insolvent; for purposes hereof "Insolvent" shall mean, with respect to the
Guarantor on a particular date, that on such date (i) the fair value of the
property of the Guarantor is less than the total amount of liabilities
(including the reasonably estimated amount of contingent liabilities) of the
Guarantor; (ii) the present fair market value of the assets of the Guarantor is
less than the amount that will be required to pay the probable liability

                                      -8-


of the Guarantor on its existing debts as they become absolute and mature; (iii)
the Guarantor is not able to realize upon its assets and pay its debts and other
liabilities, contingent obligations and other commitments as they mature in the
normal course of business; or (iv) the Guarantor has unreasonably small capital
to engage in business or a transaction.

                   (h) The Guarantor has timely filed (including any permitted
extensions) all income tax returns it is required to file, except for certain
tax returns that were due on December 15, 1994 and not timely filed because
CEC's request for a change in tax year has been granted. The information filed
in such tax returns is complete and accurate in all material respects. All
deductions taken in such income tax returns are in accordance with applicable
laws and regulations, except deductions that may have been disallowed but are
being challenged in good faith and for which adequate reserves have been made in
accordance with generally accepted accounting principles. All taxes,
assessments, fees and other governmental charges for periods beginning prior to
the date hereof, have been timely paid and the Guarantor does not have any
material liability for taxes in excess of the amounts so paid or reserves so
established. No deficiencies for taxes have been claimed, proposed or assessed
by any taxing or other Governmental Authority against the Guarantor and no tax
lien has been filed. There are no pending or threatened audits, investigations
or claims for or relating to any material liability for taxes and there are no
matters under discussion with any Governmental Authority which could result in a
material additional liability for taxes. No extension of a statute of
limitations relating to taxes, assessments, fees or other governmental charges
is in effect with respect to the Guarantor. The Guarantor does not have any
obligation under any written tax sharing agreement or agreement regarding
payments in lieu of taxes.

                  SECTION 6.  Certain Covenants.  The Guarantors covenant and
agree that, until the occurrence of the Termination Date:

                   (a) CEC shall not create or incur, and the consolidated
subsidiaries (including any corporation or partnership owned or controlled,
directly or indirectly ("Subsidiaries") of CEC other than those Subsidiaries
listed in Schedule II hereto (the "Excluded Subsidiaries") shall not create or
incur, any obligation, direct or indirect and contingent or otherwise, with
respect to indebtedness for borrowed money or for the deferred purchase price of
property or services ("Indebtedness") other than (i) Indebtedness created or
incurred prior to the date hereof (including, without limitation, the
approximately $41 million principal amount outstanding as of the date hereof of
certain term loans made to certain subsidiaries of CEC pursuant to a Loan
Agreement dated as of August 6, 1993 among such subsidiaries, General Electric
Capital Corporation as Agent for the Lenders and the other parties thereto) and
(ii) Indebtedness created or incurred on or after the date hereof if the
aggregate amount thereof (excluding the Obligations) does not exceed $20 million
at any time.

                                      -9-



                   (b) Neither CEC nor any of its consolidated Subsidiaries
other than the Excluded Subsidiaries shall voluntarily create, assume, or incur,
or permit to be created, assumed, or incurred, any mortgage, lien, pledge,
security interest or other charge or encumbrance or other preferential
arrangement of any kind upon or with respect to any of their properties, whether
such properties and assets are now owned or hereafter acquired, or upon or with
respect to any right to receive income, now or hereafter existing; provided,
that CEC and any Subsidiary thereof shall be permitted, without making or
causing to be made the provision above described, to assume or create other
security interests (i) for taxes, assessments or government charges if the same
shall not at the time be delinquent or thereafter can be paid without penalty,
(ii) imposed by law, such as carriers', warehousemen's and mechanics' liens and
other similar liens arising in the ordinary course of business and not material
in amount, (iii) arising out of pledges or deposits under workmen's compensation
laws, unemployment insurance, old-age pensions, or other social security or
retirement benefits or similar legislation and (iv) securing Indebtedness which
CEC and its consolidated Subsidiaries are permitted to create or incur under
Section 6(a)(ii) hereof.

                   (c) CEC shall give written notice to the Agent and each of
the Lender Parties of the commencement or occurrence of any action (including
substantive negotiations) or event which CEC is, or if successfully pursued
would be, required under the Securities and Exchange Commission's rules and
regulations, to report on Form 8-K. CEC agrees that it shall provide to the Line
of Credit Lenders periodic updates of the status of any such action (including
substantive negotiations) or event on a reasonably frequent basis, as well as at
the request of either Line of Credit Lender. No such information disclosed by
CEC in any such notice shall be publicly disclosed by the Agent or any Lender
Party until CEC's public disclosure of such information or until such
information shall otherwise become public (other than by action of the Line of
Credit Lenders).

                   (d) CEC shall not amend or consent to any amendment or waiver
of, or permit the Borrower or any other subsidiary of CEC to amend or consent to
any amendment or waiver of, any provision of any of (i) the articles or
certificates of incorporation, by-laws, partnership agreements, other
constituting documents, or any other agreements, instruments or documents
governing or affecting the ownership of any equity interest which are
contemplated by or referred to in Annex 2 to the Letter Agreement or (ii) any of
the other agreements, instruments or documents which are contemplated by or
referred to in Annex 2 to the Letter Agreement if, in the case of this clause
(ii), the effect of such amendment, consent or waiver could be reasonably likely
to be materially adverse to the interests of any of the Lender Parties or the
Agent. CEC agrees that unless such agreements, instruments or documents are
terminated by a party other than CEC or one of its affiliates, all such
agreements, instruments or documents shall remain in full force and effect;
provided, however, that the covenant contained in this sentence shall not apply
in the case of a termination of the agreement referred to in item 5 of 
Annex 2 to the Letter Agreement.

                                      -10-



                   (e) CEC shall not declare or pay any dividend on or make any
payment or other distribution to holders of its capital stock (other than in
additional shares of such capital stock).

                   (f) The Guarantors shall not, and shall not permit any of the
Pledged Subsidiaries (as defined in the Guarantors Pledge Agreement) or any
direct or indirect Subsidiary of any of the Pledged Subsidiaries to, sell,
transfer or otherwise dispose of any assets of any of the Pledged Subsidiaries
or any such Subsidiaries (i) to any affiliate of CEC other than the Borrower or
any Guarantor, (ii) to any Person other than the Borrower or any Guarantor
unless such sale, transfer or other disposition is for all cash or Cash
Equivalents and such cash or Cash Equivalents remain an undiminished asset of
any such Pledged Subsidiaries or such other Subsidiary. The foregoing
restriction shall not apply to (A) sales of Inventory to unaffiliated Persons in
the ordinary course of business, consistent with past practice, (B) arrangements
in existence on the date hereof and disclosed on Schedule III hereto, (C) the
intercompany transfer between Castle and its Subsidiaries of the cash proceeds
of working capital assets in the ordinary course of business, consistent with
past practice, and (D) the intercompany transfer of cash by any of the Pledged
Subsidiaries to any other Pledged Subsidiary that is a Guarantor.

                  SECTION 7. Amendments; Supplement. No amendment or waiver of
any provision of this Guaranty, and no consent to any departure by one or more
Guarantors herefrom, shall in any event be effective unless the same shall be in
writing and signed by the Agent, each Lender Party and the relevant Guarantor or
Guarantors and then such waiver or consent shall be effective only in the
specific instance and for the specific purpose for which given.

                  SECTION 8. Addresses for Notices. All notices and
correspondence hereunder shall be in writing and sent by certified or registered
mail, return receipt requested, or by overnight delivery service with all
charges prepaid, if to any Guarantor at its address set forth in Schedule I
hereto, with a copy to Duane, Morris & Heckscher, One Liberty Place,
Philadelphia, PA 19103, Attention: Sheldon M. Bonovitz, Esq., Facsimile No.:
215-979-1020; and if to the Agent or any of the Lender Parties, at its address
specified on Schedule I hereto, with a copy to Dorsey & Whitney, 350 Park
Avenue, New York, NY 10022, Attention: Joel M. Simon, Esq. Facsimile No.: (212)
888-0018, or, as to any party, at such other address as shall be designated by
such party in a written notice to each other party. All such notices and
correspondence shall be deemed given (i) if sent by certified or registered
mail, four (4) Business Days after being post marked, (ii) if sent by overnight
delivery service, when received at the above stated addresses or when delivery

                                      -11-



is refused and (iii) if sent by facsimile transmission, when receipt of such 
transmission is acknowledged; provided, that notices to the Agent shall not be 
effective until received by the Agent.

                  SECTION 9. No Waiver; Remedies. No failure on the part of the
Agent or any Lender Party to exercise, and no delay in exercising, any right
hereunder shall operate as a waiver thereof; nor shall any single or partial
exercise of any right hereunder preclude any other or further exercise thereof
or the exercise of any other right. The remedies herein provided are cumulative
and not exclusive of any remedies provided by law.

                  SECTION 10. Right of Set-off. Upon the occurrence of a Demand
Event, the Agent and each Lender Party is hereby authorized at any time and from
time to time, to the fullest extent permitted by law, to set-off and appropriate
and apply any and all deposits (general or special, time or demand, provisional
or final) at any time held and other indebtedness at any time owing by the Agent
or such Lender Party to or for the credit or the account of a Guarantor against
any and all of the obligations of such Guarantor now or hereafter existing under
this Guaranty, whether or not the Agent or such Lender Party shall have made any
demand under this Guaranty and although such obligations may be contingent and
unmatured. Each of the Agent and the Lender Parties agrees to notify the
Guarantors after any such set-off and application made by such Person, provided
that the failure to give such notice shall not affect the validity of such
set-off and application. The rights of each of the Agent and the Lender Parties
under this Section are in addition to other rights and remedies (including,
without limitation, other rights of set-off) which the Agent or such Lender
Parties may have.

                  SECTION 11. Continuing Guaranty; Assignments under Letter
Agreement. This Guaranty is a continuing guaranty and shall (i) remain in full
force and effect until the occurrence of the Termination Date, (ii) be binding
upon each of the Guarantors and their respective successors and permitted
assigns, and (iii) inure to the benefit of, and be enforceable by, the Agent and
the Lender Parties and their respective successors, transferees and permitted
assigns. Without limiting the generality of the foregoing clause (iii), the
Agent or any Line of Credit Lender may assign or otherwise transfer all or any
portion of its rights and obligations under this Guaranty to any other Person to
whom an assignment is made in accordance with the Letter Agreement and such Line
of Credit Lender's Note, and such other Person shall thereupon become vested
with all the benefits in respect thereof granted to the Agent or such Lender
Party herein or otherwise. No Guarantor may assign any of its rights and
obligations under this Guaranty without the prior written consent of each of the
Lender Parties.


                                      -12-



              SECTION 12. Indemnification. The Guarantors hereby agree to
indemnify and hold harmless the Agent, each Lender Party and each director,
officer, employee, affiliate and agent thereof (each, an "Indemnified Person")
against, and to reimburse each Indemnified Person, upon its demand, for, any
losses, claims, damages, liabilities or other reasonable expenses ("Losses") to
which such Indemnified Person may become subject insofar as such Losses arise
out of or relate to or result from (x) any investigation or defense of, or
participation in, any legal proceeding relating to the Letter Agreement, this
Guaranty, the Pledge Agreement and any other Line Document and the transactions
contemplated hereby and thereby or (y) any claim, action, suit, investigation or
proceeding relating to the Agent or any Lender Party or affiliate thereof,
whether the Indemnified Party is a party thereto or target thereof, or, if not,
in which the indemnified person or entity is subpoenaed or required to produce
documents, including, without limitation, in each case Losses consisting of
reasonable attorneys' fees or other expenses incurred in connection with
investigating, defending or participating in any such legal proceeding (whether
or not such Indemnified Person is a party thereto), provided that the foregoing
will not apply to any Losses to the extent they (i) are found by a decision of a
court of competent jurisdiction in a final non-appealable judgment to have
resulted from the gross negligence or willful misconduct of such Indemnified
Person or (ii) arise out of claims by one Indemnified Person against another
Indemnified Person.

                  SECTION 13. Payments. The Guarantors agree that all payments
made hereunder will be paid to the Agent without set-off or counterclaim at the
office of the Agent located at the address set forth in Section 10. Each
Guarantor agrees that whenever it shall make any payment on account of its
liability hereunder it will promptly notify the Agent in writing that such
payment is made under this Guaranty for such purpose.

                  SECTION 14. Expenses. Each Guarantor agrees to pay or
reimburse the Agent and the Lender Parties for any and all expenses (including
reasonable attorneys' fees and expenses) incurred by the Agent or any Lender
Party in enforcing any rights under this Guaranty.

                  SECTION 15.  Submission to Jurisdiction; Waiver of Immunities.
EACH GUARANTOR HEREBY IRREVOCABLY AND UNCONDITIONALLY:

                   (i) SUBMITS FOR ITSELF AND ITS PROPERTY IN ANY LEGAL ACTION
     OR PROCEEDING RELATING TO THIS AGREEMENT AND THE OTHER LINE DOCUMENTS TO
     WHICH IT IS A PARTY, OR FOR RECOGNITION AND ENFORCEMENT OF ANY JUDGMENT IN
     RESPECT THEREOF, TO THE NON-EXCLUSIVE GENERAL JURISDICTION OF THE COURTS OF
     THE STATE OF NEW YORK, THE COURTS OF THE UNITED STATES OF AMERICA FOR THE
     SOUTHERN DISTRICT OF NEW YORK AND APPELLATE COURTS FROM ANY THEREOF;

                                      -13-



     

                   (ii) CONSENTS THAT ANY SUCH ACTION OR PROCEEDING MAY BE
     BROUGHT IN SUCH COURTS AND WAIVES ANY OBJECTION THAT IT MAY NOW OR
     HEREAFTER HAVE TO THE VENUE OF ANY SUCH ACTION OR PROCEEDING IN ANY SUCH
     COURT OR THAT SUCH ACTION OR PROCEEDING WAS BROUGHT IN AN INCONVENIENT
     COURT AND AGREES NOT TO PLEAD OR CLAIM THE SAME;

                   (iii) AGREES THAT SERVICE OF PROCESS IN ANY SUCH ACTION OR
     PROCEEDING MAY BE EFFECTED BY MAILING A COPY THEREOF BY REGISTERED OR
     CERTIFIED MAIL (OR ANY SUBSTANTIALLY SIMILAR FORM OF MAIL), POSTAGE
     PREPAID, TO THE BORROWER AT ITS ADDRESS SET FORTH IN SECTION 7(a) HEREOF OR
     AT SUCH OTHER ADDRESS OF WHICH THE AGENT SHALL HAVE BEEN NOTIFIED PURSUANT
     THERETO;

                   (iv) AGREES THAT NOTHING HEREIN SHALL AFFECT THE RIGHT TO
     EFFECT SERVICE OF PROCESS IN ANY OTHER MANNER PERMITTED BY LAW OR SHALL
     LIMIT THE RIGHT TO SUE IN ANY OTHER JURISDICTION; AND

                   (v) WAIVES THE RIGHT TO ASSERT ANY SETOFF, COUNTERCLAIM OR
     CROSS-CLAIM IN RESPECT OF, AND ALL STATUTES OF LIMITATIONS WHICH MAY BE
     RELEVANT TO, SUCH ACTION OR PROCEEDING.

                  SECTION 16. Governing Law. THE VALIDITY, INTERPRETATION AND
ENFORCEMENT OF THIS GUARANTY AND THE OTHER LINE DOCUMENTS TO WHICH ANY GUARANTOR
IS A PARTY AND ANY DISPUTE ARISING OUT OF OR IN CONNECTION WITH THIS GUARANTY OR
ANY OF THE OTHER LINE DOCUMENTS, WHETHER SOUNDING IN CONTRACT, TORT, EQUITY OR
OTHERWISE, SHALL BE GOVERNED BY THE INTERNAL LAWS AND DECISIONS OF THE STATE OF
NEW YORK.

                  SECTION 17. Waiver of Jury Trial. EACH GUARANTOR HEREBY
IRREVOCABLY WAIVES ANY RIGHT TO TRIAL BY JURY IN ANY ACTION OR PROCEEDING
ARISING OUT OF THIS GUARANTY OR ANY OTHER LINE DOCUMENTS TO WHICH IT IS A PARTY
OR THE TRANSACTIONS RELATED HERETO OR THERETO.

                                      -14-



                  SECTION 18. Entire Agreement. THIS WRITTEN AGREEMENT, TOGETHER
WITH THE OTHER AGREEMENTS REFERRED TO HEREIN, REPRESENTS THE FINAL AGREEMENT
BETWEEN THE PARTIES WITH RESPECT TO THE MATTERS COVERED HEREBY AND MAY NOT BE
CONTRADICTED BY EVIDENCE OF PRIOR, CONTEMPORANEOUS OR SUBSEQUENT ORAL AGREEMENTS
BY THE PARTIES. THERE ARE NO UNWRITTEN ORAL AGREEMENTS BETWEEN THE PARTIES.







































                                      -15-



                  IN WITNESS WHEREOF, each Guarantor has caused this Guaranty to
be duly executed and delivered by its respective officer thereunto duly
authorized as of the date first above written.

                                       CASTLE ENERGY CORPORATION


                                       By:     /s/ Joseph L. Castle II
                                          -------------------------------------
                                          Name: Joseph L. Castle II
                                          Title: CEO

                                       CASTLE PRODUCTION RESOURCE
                                         COMPANY

                                       By:     /s/ Joseph L. Castle II
                                          -------------------------------------
                                          Name: Joseph L. Castle II
                                          Title: CEO

                                       CASTLE PRODUCTION COMPANY


                                       By:     /s/ Joseph L. Castle II
                                          -------------------------------------
                                          Name: Joseph L. Castle II
                                          Title: CEO


Accepted as of the date first above written:

BT COMMERCIAL CORPORATION,
   as Agent

By:    /s/ J. Jeffcott Ogden
   --------------------------------
   Name:    J. Jeffcott Ogden
   Title:   


                                      -16-