A federal judge ruled Tuesday that an insurer is obligated to defend and indemnify a Boston contractor accused in an underlying $1.14 million lawsuit for negligently causing the collapse of a four-story brick building during renovations.

Capitol Specialty Insurance Co. sought a declaratory judgment in the U.S. District Court for the District of Massachusetts stating that, under a general liability policy, it had no duty to defend or indemnify the defendants, Dello Russo Enterprises and Michael Dello Russo, in an underlying action against them in Massachusetts Superior Court, according to a federal order filed Tuesday.