Foul refers to direct free kick offences. Any defender committing a foul against an attacker in the area results in a penalty kick.
But, an attacker committing a foul against a defender would result in a direct free kick.
Three types of kicks in soccer are penalty kick, free kick, and corner kick. A penalty kick happens when a foul is committed in the penalty area, a free kick is awarded after a foul outside the penalty area, and a corner kick is given when the defending team plays the ball over their own goal line.
A free kick takes place from the spot where the foul occurred. If the foul happened outside the penalty area, the free kick is taken from that spot. If the foul occurred inside the penalty area, the free kick is taken from the nearest point on the penalty area line.
It would depend on who committed the foul. A foul committed by a defender, against an attacker, in the penalty area is a penalty kick for the attackers. A foul committed by an attacker, against a defender, in the penalty area is a direct free kick for the defense.
If a foul is committed inside the goal area then it is also inside the penalty area. Any foul normally punishable by a direct free kick that is committed inside the penalty area by the defense is changed to a penalty kick.
When a foul, specifically a direct free kick offense, is committed by a defender, against an attacker, in the penalty area.
A foul does not have to be near the ball. A foul must occur (1) by a player, (2) on the field of play, (3) against an opponent, and (4) while the ball is in play. If the foul you describe is by a defender, against an attacker, in the defender's penalty area then play is stopped and a penalty kick awarded. Depending on the severity, it could also be misconduct.
A direct free kick or a penalty kick depending on where the foul occurred.
For a foul committed outside the penalty area in soccer, a direct free kick is awarded to the opposing team. The kick is taken from the spot where the foul occurred, and the defending players must stand at least 10 yards away until the ball is in play. The attacking team can score directly from the kick. If the foul is deemed less severe, an indirect free kick may be awarded instead.
The ball exiting the field across the goal line is not a foul. The restart would be a kick off, goal kick, or corner kick depending on who touched it last, which goal line, and whether it went in the goal.
A foul that resulted in a penalty kick.
If a foul occurs in the goal area lines, the opposing team may be awarded a penalty kick, which is a direct free kick taken from the penalty spot inside the penalty area.
Here there will be no penalty given, only a direct free kick from the location of the foul.