A communications method, comprising: receiving, by a first access and mobility management function network element in a first communications network, a first message from a terminal device, wherein the first message comprises a non-access stratum NAS parameter used by the terminal device to access a second communications network; sending, by the first access and mobility management function network element, a second message to a second access and mobility management function network element in the second communications network, wherein the second message comprises the NAS parameter; wherein, if authentication between an authentication server in the second communications network and the terminal device succeeds, the method further comprises: performing, by the first access and mobility management function network element, security protection on a first security mode command based on a key of the first communications network, wherein the first security mode command is used to enable security protection for message exchange between the terminal device and the first communications network; and sending, by the first access and mobility management function network element to the terminal device, the first security mode command on which the security protection is performed; wherein the method further comprises: receiving, by the first access and mobility management function network element, a second security mode command from the second access and mobility management function network element, and sending the second security mode command to the terminal device, wherein the second security mode command is used to enable security protection for message exchange between the terminal device and the second communications network. receiving, by a first access and mobility management function network element in a first communications network, a first message from a terminal device, wherein the first message comprises a non-access stratum NAS parameter used by the terminal device to access a second communications network; sending, by the first access and mobility management function network element, a second message to a second access and mobility management function network element in the second communications network, wherein the second message comprises the NAS parameter; wherein, if authentication between an authentication server in the second communications network and the terminal device succeeds, the method further comprises: performing, by the first access and mobility management function network element, security protection on a first security mode command based on a key of the first communications network, wherein the first security mode command is used to enable security protection for message exchange between the terminal device and the first communications network; and sending, by the first access and mobility management function network element to the terminal device, the first security mode command on which the security protection is performed; wherein the method further comprises: performing, by the first access and mobility management function network element, security protection on a first security mode command based on a key of the first communications network, wherein the first security mode command is used to enable security protection for message exchange between the terminal device and the first communications network; and sending, by the first access and mobility management function network element to the terminal device, the first security mode command on which the security protection is performed; wherein the method further comprises: receiving, by the first access and mobility management function network element, a second security mode command from the second access and mobility management function network element, and sending the second security mode command to the terminal device, wherein the second security mode command is used to enable security protection for message exchange between the terminal device and the second communications network.