Mercenaries
By moving military units into your capital you are able to rent them as a mercenary force to foreign civs in the trade negotiation window. A mercenary deal lasts for 20 turns and if there are units left (see below) at that point they are automatically returned to your capital.
A mercenary unit is in the full control of the receiving civ as long as the deal lasts with the sole exception that it won't attack against its own civ. If a war breaks out between the two civs the mercenary deal is automatically broken with the civ who declared war getting a reputation hit.
The original civ owning the unit pays its upkeep costs if any. Of course, the upkeep costs will usually just be transferred to the rent price. This is mainly to avoid the disbanding problems when there's no gold left to pay for the unit upkeep. The real world explanation is that the owning civ equips the troops (upkeep cost) and the civ that rents them pays a packet price for it.
When a mercenary unit does battle it fights until it is reduced to 1 hit point. At that point it has had enough and surrenders. Afterall it's just a business deal for them and not exactly their war. When a mercenary unit surrenders the owning civ pays X gold as ransom and the red lined unit is returned to its capital. If the owning civ doesn't have the gold then too bad and the unit is disbanded.
The surrender and ransom reflect the lower morale of mercenary troops (effectively a -1hp penalty) and it also eliminates the possible "pseudo mercenary deal" abuse in multiplayer games: two humans switching their troops with each other to get an "instant teleport back when wounded" military.
As the price of the mercenary deal is negotiable it allows you to help other civs without going to war yourself by just giving the mercs for 20 turns as a gift. In fact that would even allow some cold war style things: Aztecs and Zulus fight it out while America equips the one and Russia the other...