The study of Ambient Intelligence environments and pervasive computing systems has introduced new research challenges in the field of Distributed Artificial Intelligence. These are mainly caused by the imperfect nature of context and the special characteristics of the entities that possess and share the available context knowledge. In such environments, context may be unknown, ambiguous, imprecise or erroneous. Ambient agents are expected to have different goals, experiences and perceptive capabilities and use distinct vocabularies to describe their context. Due to the highly dynamic and open nature of the environment and the unreliable wireless communications that are restricted by the range of transmitters, ambient agents do not typically know a priori all other entities that are present at a specific time instance nor can they communicate directly with all of them. Motivated by these challenges, we propose a fully distributed approach for contextual reasoning in Ambient Intelligence environments, which combines the virtues of Multi-Context Systems and Defeasible Argumentation. The general approach consists of three models: (a) a representation model, which is a nonmonotonic extension of Multi-Context Systems; according to this, local context knowledge of ambient agents is encoded in rule theories (contexts), and information flow between agents is achieved through defeasible mapping rules that associate concepts used by different contexts; (b) an argument-based reasoning model, in which conflicts that arise from the interaction of mutually inconsistent contexts are captured through attacking arguments, and conflict resolution is achieved by ranking arguments according to a preference ordering on the system contexts; and (c) an operational model in the form of four distributed algorithms for query evaluation, each of which implements a different strategy for conflict resolution. The proposed models have been implemented and evaluated in Ambient Intelligence and Social Networking scenarios, which involve interaction between several different types of stationary and mobile devices communicating through wireless networks.