This paper describes a security architecture for mobile agent based systems. It defines the notion of a security-enhanced agent and outlines security management components in agent platform bases and considers secure migration of agents from one base to another. The security enhanced agent carries a passport that contains its security credentials and some related security code. Then we describe how authentication, integrity and confidentiality, and access control are achieved using the agent's passport and the security infrastructure in the agent bases. We then discuss the application of the security model in roaming mobile agents and consider the types of access control policies that can be specified using the security enhanced agents and the policy base in the agent platforms. Finally we describe the security infrastructure that implements the proposed security services and outline the development of a secure agent based application using the proposed architecture.