<PAGE>   1
                                                                    EXHIBIT 10.4

                            STOCK PURCHASE AGREEMENT


         This Stock Purchase Agreement ("AGREEMENT"), dated as of July 18, 2001,
is entered into by and between Security Associates International, Inc., a
Delaware corporation (the "COMPANY"), and EGI-Fund (01) Investors, L.L.C., a
Delaware limited liability company (the "PURCHASER").

         1. Purchase of Shares. Subject to the terms and conditions of this
Agreement, the Purchaser hereby agrees to purchase, and the Company hereby
agrees to sell to Purchaser, shares (the "SHARES") of a to be designated new
series (the "NEW SERIES") of convertible, participating preferred stock of the
Company, senior to the Company's common stock, par value $0.001 per share
("COMMON STOCK"), pari passu with the Company's Series A Preferred Stock, and
convertible into 2,000,000 shares (the "CONVERSION SHARES") of Common Stock,
representing as of the Closing Date no less than 5% of the Company's Common
Stock on a fully-diluted basis, for a total purchase price of five million
dollars ($5,000,000).

         2. Closing Date. Provided the conditions of this Agreement are
satisfied, the closing (the "CLOSING") shall take place on September 10, 2001,
at the offices of Sachnoff & Weaver, Ltd., 30 S. Wacker Drive, 29th Floor,
Chicago, Illinois 60606, or at such earlier time or other place as the Company
and the Purchaser may agree upon in writing (the "CLOSING DATE"). At the
Closing, the Company shall deliver to the Purchaser, free and clear of all
liens, claims or encumbrances (other than those created by Purchaser),
certificates representing the Shares upon payment of $5,000,000 by wire transfer
of immediately available funds to an account designated in writing by the
Company. In addition, at the Closing, for additional consideration of $1,000 in
the aggregate, the Company shall issue Purchaser transferable (subject to
Section 4) warrants (the "WARRANTS") with a four-year term to purchase two
million five hundred thousand (2,500,000) shares of Common Stock (the "WARRANT
SHARES"), representing as of the Closing Date no less than 6% of the Company's
Common Stock on a fully-diluted basis, at an exercise price of $2.50 per share.

         3.       Conditions to Closing.

         (a)      Conditions to the Company's Closing.

                  (i)  The representations and warranties of the Purchaser shall
         be true and correct when made and shall be true and correct in all
         material respects as of the Closing Date; and

                  (ii) As of the Closing Date, the consummation of the
         transaction contemplated by this Agreement shall not violate any order,
         decree or judgment of any court or governmental entity.



<PAGE>   2
         (b)      Conditions to the Purchaser's Closing.

                  (i) The representations and warranties of the Company shall be
         true and correct when made and shall be true and correct in all
         material respects as of the Closing Date;

                  (ii) As of the Closing Date, the consummation of the
         transaction contemplated by this Agreement shall not violate any order,
         decree or judgment of any court or governmental entity;

                  (iii) The Purchaser shall have completed it due diligence
         investigation of the Company and its subsidiaries and shall have been
         satisfied with the results thereof in its sole and absolute discretion;

                  (iv) No circumstances or events shall have arisen from the
         date of this Agreement having a material adverse effect (or any
         development which could reasonably be expected to have a material
         adverse effect) on the business, operations, assets, financial or other
         condition, results of operations or prospects of the Company and its
         subsidiaries, taken as a whole, or that could reasonably be expected to
         impair or delay the ability of the Company to perform its obligations
         under this Agreement;

                  (v)  The Purchaser shall have received an opinion of Sachnoff
         & Weaver, Ltd., counsel to the Company, in form and substance
         satisfactory to the Purchaser in its reasonable discretion;

                  (vi) The Company shall have filed the Certificate of
         Designation for the New Series in form and substance satisfactory to
         the Purchaser in its sole and absolute discretion, and the same shall
         be effective no later than the Closing Date;

                  (vii) The Purchaser's board designee shall have been appointed
         to serve as a member of the Board; and

                  (ix) The Company shall have provided Purchaser and its
         representatives with full access at reasonable times, and in a manner
         so as not to interfere with the normal business operations of the
         Company, to designated representatives of the Company and to all books,
         records, contracts and documents of or pertaining to the Company for
         purposes of the Purchaser's due diligence review of the Company, which
         due diligence review shall be carried out as expeditiously as is
         commercially reasonable and as close to July 31, 2001 as possible but
         shall be completed in any event by August 15, 2001 or such later date
         as the parties may agree upon.

         4. Purchaser's Investment Representations. Purchaser hereby
represents and warrants to the Company that, as of the Closing:

         (a) Purchaser is acquiring the Shares acquired hereunder for its own
account with the intention of holding such securities for purposes of
investment, and the Purchaser has no



                                       2
<PAGE>   3
intention of selling such securities in a public distribution in violation of
the federal securities laws or any applicable state securities laws.

         (b) Purchaser has had an opportunity to ask questions and receive
answers from the Company and review documents, books and records of the Company
as it deems necessary to evaluate the investment considerations involved
concerning the Company as it has requested.

         (c) Purchaser has such knowledge and expertise in financial and
business matters that the Purchaser is capable of evaluating the merits and
risks involved in an investment in the Shares and acknowledges that an
investment in the Shares entails a number of very significant risks. Purchaser
is an "accredited investor" as defined in Regulation D promulgated under the
Securities Act of 1933, as amended (the "SECURITIES ACT"). Purchaser was not
organized for the specific purpose of acquiring the Shares.

         (d) Purchaser has the full power and authority to execute and deliver
this Agreement and to perform its obligations hereunder, subject to approval of
its managing member. Purchaser has taken all necessary action to authorize its
execution, delivery and performance of and under this Agreement. The Agreement
constitutes the legal, valid and binding obligation of Purchaser, enforceable in
accordance with its terms, and the execution, delivery and performance of this
Agreement by Purchaser does not conflict with, violate or cause a breach of any
agreement, contract or instrument to which Purchaser is a party or any judgment,
order or decree to which Purchaser is subject.

         (e) Purchaser understands that the Shares acquired pursuant hereto are
not registered under the Securities Act, or any state securities acts and are
instead being offered and sold in reliance on an exemption for private offerings
under the Securities Act and are subject to restrictions on transfer.

         (f) Purchaser has had the opportunity to review each registration
statement, schedule, report, proxy statement or information statement that the
Company has filed with the Securities and Exchange Commission ("SEC") (the
"Company Reports"), and has reviewed the Company's Quarterly Report on Form 10-Q
for the quarter ended March 31, 2000, and the other Company Reports filed since
the filing of said Quarterly Report, including the section regarding "Risk
Factors" set forth in the Company's Annual Report on Form 10-KSB as filed with
the SEC on April 17, 2001.

         (g) Purchaser has not engaged any broker or finder who is entitled to
any fee or commission from the Company in connection with this Agreement or the
transactions contemplated hereby.

         5. Representations and Warranties of the Company. The Company hereby
represents and warrants to the Purchaser that:

         (a) The Company is a corporation duly organized, validly existing, and
in good standing under the laws of the State of Delaware. The Company has all
requisite corporate



                                       3
<PAGE>   4
power and authority to own or lease and operate its properties and to carry on
its business as now conducted.

         (b) The Company has the full power and authority to execute and deliver
this Agreement and to perform its obligations hereunder. The Company has taken
all necessary corporate action to authorize its execution, delivery and
performance of and under this Agreement. The Agreement constitutes the legal,
valid and binding obligation of the Company, enforceable in accordance with its
terms, and the execution, delivery and performance of this Agreement by the
Company does not conflict with, violate or cause a breach of any agreement,
contract or instrument to which the Company is a party or any judgment, order or
decree to which the Company is subject.

         (c) As of the Closing Date, the Company Reports, as supplemented by any
additional disclosures by the Company to Purchaser (including subsequently filed
Company Reports filed at least five (5) business days prior to Closing), will
not contain any untrue statement of a material fact or omit to state a material
fact required to be stated therein or necessary to make the statement made
therein, in light of the circumstances in which they were made, not misleading.
Each Company Report filed pursuant to the Securities Exchange Act of 1934, as
amended (the "EXCHANGE ACT"), complied when filed in all material respects with
the Exchange Act.

         (d) All Shares acquired hereunder are duly authorized, validly issued,
fully paid, and nonassessable.

         6. Legend. Purchaser understands and agrees that the following
restriction and limitation is applicable to the its investment in the Shares and
Warrants pursuant to Section 4(2) of the Securities Act and Regulation D and
that the certificates representing the Shares, Conversion Shares, the Warrants
and the Warrants Shares will contain the following legend:

                  The securities represented hereby have not been registered
                  under the Securities Act of 1933, as amended, or any state
                  securities laws and neither securities nor any interest
                  therein may be offered, sold, transferred, pledged or
                  otherwise disposed of except pursuant to an effective
                  registration statement under such act or such laws or an
                  exemption from registration under such act and such laws.

         7. Board Representation. From and after the Closing Date, provided that
the transaction contemplated hereby has been consummated, until the date on
which the Purchaser has sold or otherwise disposed of more than 50% of the total
shares of underlying Common Stock represented by the Shares and the Warrants,
other than to direct and indirect affiliates and members, the Company shall
nominate one (1) individual designated by the Purchaser for election to the
board of directors of the Company (the "BOARD") and use its commercially
reasonable efforts to cause such individual to be elected to the Board.

         8. Preemptive Rights. For a period of eighteen (18) months after the
Closing Date, provided that the transaction contemplated hereby has been
consummated, if the Company proposes to sell securities for cash to raise
additional capital in one or more financings (other than non-convertible or
non-exchangeable debt) (a "FINANCING"), the Company shall provide



                                       4
<PAGE>   5
written notice of the terms of such Financing (the "FINANCING NOTICE") to
Purchaser at least twenty (20) days prior to the date on which such Financing is
proposed to be consummated. Purchaser shall have the right to participate in
such proposed Financing on the terms set forth in the Financing Notice by
delivering notice of the amount of securities it shall purchase in such
Financing to the Company within ten (10) days of Purchaser's receipt of the
Financing Notice. Purchaser may purchase up to fifty percent (50%) of the
aggregate securities the Company issues in any such Financing. The rights
granted to Purchaser pursuant to this Section 8 shall not apply to any rights or
other offering made to the Company's security holders or its employees, officers
and directors and shall expire at the earlier of (i) such time that Purchaser
has purchased an aggregate of $10 million of securities of the Company pursuant
to this Section 8 or (ii) eighteen (18) months after the Closing Date.

         9. Confidentiality. Purchaser shall treat as confidential and will not
use (other than for the purposes of its due diligence review), disclose or
otherwise make available any Confidential Information of the Company to any
person other than Purchaser's affiliates and its and its affiliate's respective
directors, officers, employees, partners, members, representatives, agents,
consultants, lenders and capital sources who have a business need to know all
Confidential Information of the Company and who agree to treat all Confidential
Information in accordance herewith. "CONFIDENTIAL INFORMATION" shall mean all
information regarding the Company disclosed by the Company or its
representatives to Purchaser or its representatives during Purchaser's due
diligence review of the Company, except for (a) information that is known to
Purchaser previously without an obligation of confidentiality, (b) information
that is or becomes publicly known other than through a breach by Purchaser of
its confidentiality obligations under this Agreement, and (c) information that
is rightfully obtained by Purchaser from a third party not know to Purchaser to
be under an obligation of confidence to the Company. Purchaser shall return all
Confidential Information to the Company upon request following a termination of
this Agreement.

         10. Neither this Agreement nor any provision hereof shall be waived,
modified, changed, discharged or terminated except by an instrument in writing
signed by the party against whom any waiver, modification, change, discharge or
termination is sought.

         11. This Agreement shall be construed in accordance with the laws of
the State of Illinois without regard to conflict of laws principles.

         12. This Agreement constitutes the entire agreement between the parties
hereto with respect to the subject matter hereof, may be amended only by a
writing executed by all of the parties and supersedes any prior agreement
between the parties with respect to the subject matter hereof.

         13. This Agreement is not transferable or assignable by Purchaser or
any successor thereto, other than to directly or indirectly controlled
affiliates of Sam Zell or trusts for the benefit of Sam Zell or his family
members.

         14. This Agreement may be terminated by either party by written notice
to the other if the transactions contemplated hereby are not closed on or prior
to September 10, 2001.


                                       5
<PAGE>   6

         IN WITNESS WHEREOF, the parties have executed this Agreement as of the
date set forth above.


SECURITY ASSOCIATES                        EGI-FUND (O1) INVESTORS, L.L.C.
INTERNATIONAL, INC.



By: /s/ James S. Brannen                   By:  /s/ Donald J. Liebentritt
   --------------------------                  ---------------------------------

Its: President                             Its:
    -------------------------                  ---------------------------------





                                       6