Exhibit 5.1



                                 March 18, 2004


Headwaters Incorporated
10653 South River Front Parkway, Suite 300
South Jordan, Utah 84095

     Re:      Registration Statement on Form S-8 of Headwaters Incorporated

Ladies and Gentlemen:

I have acted as counsel to Headwaters Incorporated, a Delaware corporation (the
"Company"), in connection with the Registration Statement on Form S-8 of the
Company, SEC File No. 333-113704 filed on March 18, 2004, to which this
opinion is attached as Exhibit 5.1 (the "Registration Statement"), with the
Securities and Exchange Commission (the "Commission"). The Registration
Statement relates to 2,500,000 shares (the "Shares") of common stock of the
Company, par value $.001 per share (the "Common Stock") consisting of shares of
Common Stock issuable in accordance with the Amended Headwaters Incorporated
2003 Stock Incentive Plan ("2003 Plan").

This opinion is an exhibit to the Registration Statement, and is being furnished
to you in accordance with the requirements of Item 601(b)(5) of Regulation S-K
under the Securities Act of 1933, as amended (the "1933 Act").

In that capacity, I have reviewed the Registration Statement and other
documents, corporate records, certificates, and other instruments for purposes
of this opinion.

In such examination, I have assumed the genuineness of all signatures, the legal
capacity of natural persons, the authenticity of all documents submitted to me
as originals, the conformity of all documents submitted to me as certified,
conformed or photostatic copies and the authenticity of the originals of such
documents. In making my examination of documents executed by parties other than
the Company, I have assumed that such parties had the power, corporate or other,
to enter into and perform all obligations thereunder and have also assumed the
due authorization by all requisite action, corporate or other, and execution and
delivery by such parties of such documents and the validity, binding effect and
enforceability thereof. As to any facts material to the opinions expressed
herein, I have, to the extent I deemed appropriate, relied upon statements and
representations of officers and other representatives of the Company and others.
This opinion only relates to the Shares included in the Registration Statement.

My opinions expressed herein are limited to the corporate law of the State of
Delaware, and I do not express any opinion herein concerning any other law.

Based upon and subject to the foregoing, and to the limitations, qualifications,
exceptions and assumptions set forth herein, I am of the opinion that the Shares
registered on the Registration Statement to be issued and sold in accordance
with the 2003 Plan, have been duly authorized and, when paid for in the manner
provided in the 2003 Plan and various agreements and instruments governing the
awards under the 2003 Plan, will be legally issued, fully paid and
non-assessable.

In rendering this opinion, I have assumed that

           i) the certificates representing the Shares will conform to the form
           of specimen examined by me and such certificates will be duly
           executed and delivered by the Company; and

           ii) the consideration for Shares as provided in the applicable
           resolutions of the Board of Directors of the Company or its
           Compensation Committee, including the consideration to be paid in
           connection with the awards, will have been actually received by the
           Company as provided therein.

I hereby consent to the filing of this opinion as an exhibit to the Registration
Statement. In giving this consent, I do not thereby admit that I am in the
category of persons whose consent is required under Section 7 of the 1933 Act or
the rules and regulations of the Commission promulgated thereunder.

                                                   Very truly yours,

                                                   /s/ Harlan M. Hatfield
                                                  ---------------------------
                                                   Harlan M. Hatfield