# Using \label within a figure float [duplicate]

Possible Duplicate:
Where to put the \label on a figure environment?

My question is rather simple. I have noticed that when I use \label like this

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{Leslie_Lamport}
\label{fig:LL}
\caption{Leslie Lamport}
\end{figure}

and then refer to this label it refers rather to the section number than to the figure (I've seen it been refered as section.figurenumber but that was due to a package I believe - possibly hyperref). But when using it after the caption

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{Leslie_Lamport}
\caption{Leslie Lamport}
\label{fig:LL}
\end{figure}

it really refers to the figure number.

Can someone explain the mechanic behind \label to me?

-