Praise be to Allah.
A man does not have to have a wali at the time of the marriage contract, rather the man is the one who enters into the marriage contract by himself. It is the woman who needs to have a wali, because the Prophet (peace and blessings of Allaah be upon him) said, according to the hadeeth narrated by ‘Aa’ishah: “Any woman who gets married without a wali, her marriage is invalid, invalid, invalid.” Narrated by al-Tirmidhi, 1102; classed as hasan by Abu Dawood, 2083; Ibn Maajah, 1879.
But if a man is insane or feeble-minded, he has to have a wali (guardian). If he is of sound mind, however, he does not need a wali.